fix(download): salvage soft-time-limit kills + fix timeout ladder #59
Reference in New Issue
Block a user
Delete Branch "dev"
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?
Fixes backfill subscriptions stranding with empty logs + a generic "stranded by recovery sweep" error (operator-flagged 2026-06-03, patreon/Anduo #39912 → #39937).
Root cause
download_sourceran gallery-dl in an executor thread with a backfill subprocess timeout of 1170s, but Celery'ssoft_time_limitwas 900s. The soft-limit signal fires in the main thread, soSoftTimeLimitExceededpreemptedsubprocess.TimeoutExpired— the path that captures partial stdout/stderr and finalizes the event never ran. The event was leftrunning→ recovery sweep stamped a context-free "stranded" 30 min later, and phase 3 never decrementedbackfill_runs_remaining, so the source re-ran and re-stranded every tick.Changes
download_sourcelimits to soft 1350 / hard 1500 so both subprocess budgets (870 tick / 1170 backfill) sit under the soft limit with phase-3 persist headroom. Promoted to module constants; invariant guarded by a test.download_sourcenow catchesSoftTimeLimitExceededand finalizes the in-flight event with a real reason, mirrors phase-3 source-health, and decrements backfill so a chronically-slow source self-heals to tick mode. (The existingcelery_signalshandler only covered theTaskRundashboard row, not theDownloadEvent— that was the gap.)gallery_dl.py+maintenance.py.Tests
4 new tests in
tests/test_download_source_task.py(timeout-ladder invariant, decorated-limit match, soft-limit event salvage + backfill decrement, no-op-without-running-event). CI green on dev HEAD.🤖 Generated with Claude Code