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:
parent
469c05ac3f
commit
b394540701
2 changed files with 52 additions and 1 deletions
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue