fix: drain YouTube backlog by capping downloads per poll #82
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
in progress
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
joezombie/castr!82
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/youtube-watcher-download-backlog"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The YouTube watcher fetched playlists fine but downloaded no new episodes for months (btb feed: 1141 playlist videos, ~831 backlog, newest file on disk dated January).
Root cause:
ProcessFeedAsyncfetched full per-video metadata for the entire not-yet-downloaded backlog (hundreds of sequentialGetVideoDetailsAsynccalls) before the download loop ran. With a large backlog this took 30–60+ minutes, so the poll never reached the download step before the container was restarted (frequent redeploys), and progress was lost every cycle.Confirmed on the live deployment: a poll spent 15+ min still in the metadata phase (video 331/1141) and reached the download step 0 times.
Fix
PlaylistVideoInfofrom titles only — no per-video detail fetch. Safe becauseSyncPlaylistInfoAsynconly needs the title to fuzzy-match files and preserves existing metadata when fields are null; full details are still fetched in Step 4 for videos actually downloaded.SelectNewVideosToDownload<T>caps downloads toMaxDownloadsPerPoll = 5per cycle, so each poll completes quickly, persists progress incrementally (MarkVideoDownloadedAsyncper video), and survives restarts. The backlog drains across polls.Tests
Castr.TestsviaInternalsVisibleTo.Tradeoff
At 5/poll on a 60-min interval the ~831 backlog drains over ~1 week. Raise
MaxDownloadsPerPollor trigger polls manually to catch up faster; the per-poll cap is the resilience mechanism.🤖 Generated with Claude Code