downloads: startup retries in a write session of its own

start_single_tasks still called retry_downloads() without a Session after it began requiring one, so any
start after a completed refresh raised TypeError there: incomplete downloads were not reset and the
download_on_startup enable after it never ran.  Startup is not a request, so
DownloadManager.retry_downloads_on_startup() opens and commits its own short write transaction.

Tested through the method, not start_single_tasks: importing main registers its startup listeners on the
shared app, and every later test in that worker then runs them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-10-04 10:58:12 -06:00
parent 24c5796fc6
commit 0297521dd1
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
3 changed files with 23 additions and 1 deletions

View file

@ -309,7 +309,7 @@ async def start_single_tasks(app: Sanic):
if flags.refresh_complete.is_set():
# Set all downloads to new.
download_manager.retry_downloads()
download_manager.retry_downloads_on_startup()
# Hotspot/throttle on startup are now handled by the Controller service.