feat(maintenance): scheduled job to retire unplayable videos
Add a daily maintenance/validation job that detects videos which can't be played anywhere and retires them safely. Two phases: re-check already-flagged videos (recover if available again, else hard-delete once the grace period elapses, cascading to states/playlist items), and a rolling re-validation of the least-recently-checked currently-available videos that flags newly-unplayable ones (hidden from the feed immediately via unavailable_since). Detection is ~free: a video missing from the videos.list response is deleted-or-private; an `upcoming` premiere >2 days past its scheduled start that never went live is abandoned. A still-live broadcast is kept (legit 24/7 stream). Enrichment now also fetches part=status to populate the status columns. Grace is 7 days for removed videos, none for abandoned. Before deleting, affected users get one batched notification (never per-video). Interval is admin-tunable via the Scheduler dashboard; batch size and grace are config. Quota-attributed to the system and bounded by the same backfill reserve as the other jobs.
This commit is contained in:
parent
b9a3a9012d
commit
c4aecf9f77
6 changed files with 280 additions and 1 deletions
|
|
@ -90,6 +90,17 @@ class Settings(BaseSettings):
|
|||
autotag_interval_minutes: int = 30
|
||||
subscriptions_resync_minutes: int = 360
|
||||
playlist_sync_minutes: int = 360
|
||||
# --- Maintenance / validation job ---
|
||||
# Runs once a day by default (admin-tunable via the Scheduler dashboard). Grace periods
|
||||
# are in days because that's the granularity that matters; the rolling re-validation
|
||||
# re-checks the least-recently-checked N videos per run (1 unit / 50 videos), so on a
|
||||
# ~233k catalog ~15000/day ≈ a 15-day full cycle for ~300 quota units.
|
||||
maintenance_interval_minutes: int = 1440
|
||||
maintenance_revalidate_batch: int = 15000
|
||||
# Grace before a flagged-unavailable video is hard-deleted (cascades to states/playlist
|
||||
# items). Deleted/private/paywalled get a recovery window; abandoned upcoming and
|
||||
# confirmed-dead stuck-live have no age grace (deleted on the sweep that confirms them).
|
||||
maintenance_grace_days: int = 7
|
||||
# live_status values hidden from the feed by default. Completed-stream VODs
|
||||
# ("was_live") are real watchable content and stay visible.
|
||||
feed_default_hidden_live: str = "live,upcoming"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue