fix(sync): re-enrich live videos so ended streams gain duration
enrich_pending only touches enriched_at IS NULL, so a video first seen while live was stamped live + duration-null and never revisited — staying 'live' with no duration forever after the broadcast ended. Add refresh_live (run after each enrich pass) that re-fetches anything still live/upcoming, plus just-ended was_live videos that haven't got their duration yet, until they settle. Cheap: videos.list is 1 unit per 50 ids.
This commit is contained in:
@@ -21,6 +21,7 @@ from app.sync.videos import (
|
||||
enrich_pending,
|
||||
poll_rss_channel,
|
||||
reconcile_full_history,
|
||||
refresh_live,
|
||||
run_shorts_classification,
|
||||
)
|
||||
from app.youtube.client import YouTubeClient
|
||||
@@ -65,6 +66,10 @@ def run_enrich(db: Session, max_batches: int = 200, floor: int = 200) -> int:
|
||||
total += n
|
||||
if n == 0:
|
||||
break
|
||||
# Revisit transient live/upcoming videos (enrich_pending is one-shot) so an ended
|
||||
# stream gains its final duration + was_live status instead of staying "live" forever.
|
||||
if quota.remaining_today(db) > floor:
|
||||
total += refresh_live(db, yt)
|
||||
return total
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user