fix: surface match live stream partial failures
This commit is contained in:
@@ -245,7 +245,7 @@ def run(db_config: Dict[str, Any]) -> Dict[str, Any]:
|
||||
|
||||
candidate_count = len(rows)
|
||||
return {
|
||||
"success": True,
|
||||
"success": failed_count == 0,
|
||||
"candidate_count": candidate_count,
|
||||
"saved_count": success_count,
|
||||
"count": success_count,
|
||||
|
||||
@@ -8,7 +8,7 @@ ROOT = Path(__file__).resolve().parents[1]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from match_live_stream import choose_next_fetch_at, parse_match_live_detail_html
|
||||
from match_live_stream import _build_detail_url, choose_next_fetch_at, parse_match_live_detail_html
|
||||
|
||||
|
||||
class MatchLiveStreamTest(unittest.TestCase):
|
||||
@@ -54,6 +54,17 @@ class MatchLiveStreamTest(unittest.TestCase):
|
||||
self.assertEqual(parsed["play_url_flv"], "http://b/flv")
|
||||
self.assertEqual(parsed["play_url_hd_flv"], "http://b/hdflv")
|
||||
|
||||
def test_build_detail_url_derives_room_id_from_source_url(self):
|
||||
detail_url = _build_detail_url(
|
||||
"https://yyzb1.tv/room/7988511?scheduleId=undefined",
|
||||
now_ts=123456,
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
detail_url,
|
||||
"https://json.ncctrials.com/room/7988511/detail.json?v=123456",
|
||||
)
|
||||
|
||||
def test_choose_next_fetch_at_uses_60s_for_empty_streams(self):
|
||||
self.assertEqual(choose_next_fetch_at(now_ts=1000, has_existing_stream=False), 1060)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user