Channel features: subscribers, new-videos badges, activity-driven sync
- Store subscriber count from YouTube statistics and show it on channel page - Sync 50 videos per channel with playlistItems pagination support - Show per-channel and per-category new-videos counters (2-day window) - Replace hourly videos sync with activity trigger (2h idle) and incremental backfill (hard cap 200 per channel) - Clicking the sidebar new-videos count filters the category feed to recent videos only (new_only) - Update agent-team docs: deploy after green checks
This commit is contained in:
parent
fde9a439df
commit
e10df8dcbd
27 changed files with 1420 additions and 107 deletions
|
|
@ -21,19 +21,9 @@ def _run_subscriptions_sync() -> None:
|
|||
db.close()
|
||||
|
||||
|
||||
def _run_videos_sync() -> None:
|
||||
db = SessionLocal()
|
||||
try:
|
||||
sync.sync_videos(db)
|
||||
except sync.SyncInProgress:
|
||||
logger.info("Scheduled videos sync skipped: already running")
|
||||
except Exception:
|
||||
logger.exception("Scheduled videos sync failed")
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
def create_scheduler() -> BackgroundScheduler:
|
||||
# Videos sync is not scheduled anymore: it runs on user activity via
|
||||
# services.sync_trigger.maybe_trigger_videos_sync (see require_session).
|
||||
scheduler = BackgroundScheduler(timezone="UTC")
|
||||
scheduler.add_job(
|
||||
_run_subscriptions_sync,
|
||||
|
|
@ -41,10 +31,4 @@ def create_scheduler() -> BackgroundScheduler:
|
|||
hours=settings.subscriptions_sync_interval_hours,
|
||||
id="subscriptions_sync",
|
||||
)
|
||||
scheduler.add_job(
|
||||
_run_videos_sync,
|
||||
"interval",
|
||||
minutes=settings.videos_sync_interval_minutes,
|
||||
id="videos_sync",
|
||||
)
|
||||
return scheduler
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue