Two background yt-dlp processes were firing every time a video page loaded: 1. importChapters (called unconditionally via useEffect on mount) was calling _upsert_video_from_yt with polite=False when chapters=NULL — no rate limiter, no download-pause check, runs concurrently with active downloads. Fix: return [] immediately when chapters=NULL and let the normal enrichment pipeline (already polite=True) fill them in. 2. get_video_by_yt_id schedules a background _enrich task whenever description or chapters are NULL. The frontend polls every 3 s while description is null, so dozens of enrichment tasks would pile up for the same video. Fix: deduplicate with _enriching set — only one background fetch per video_id at a time; the set entry is cleared when the task finishes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
47 KiB
47 KiB