Fix popular fetch and improve date/view_count coverage

Popular fetch now does a two-phase approach: fast flat-playlist to get
IDs in popularity order, then parallel full metadata fetch (8 workers)
to get real view_count and published_at for each video. Previously
flat-playlist mode returned timestamp/view_count as null.

Enrich task now also backfills published_at and view_count (not just
description). Startup limit 3→50, enrichment sleep 2s→0.5s.

Raise all thread pool sizes to match 8-core machine:
- Discovery search: 5→8 workers
- Graph signal: 4→8 workers
- Popular fetch: 5→8 workers
- Download semaphore default 3→6, cap 10→16

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-26 22:36:18 +02:00
parent 5b0cf27f07
commit 2f37072187
5 changed files with 82 additions and 56 deletions

View File

@@ -168,7 +168,7 @@ def on_startup():
# Backfill descriptions for videos that don't have them yet (runs in background)
import threading
from .routers.channels import _enrich_missing_task, _index_channels_batch
threading.Thread(target=_enrich_missing_task, args=(3,), daemon=True).start()
threading.Thread(target=_enrich_missing_task, args=(50,), daemon=True).start()
def _auto_sync_daemon():
import time