Skip to content

manager.py: Fix shutdown signaling and tight retry loop in download job manager#47

Open
MateoGonzalezLourido wants to merge 2 commits into
Heroic-Games-Launcher:masterfrom
MateoGonzalezLourido:fix-worker
Open

manager.py: Fix shutdown signaling and tight retry loop in download job manager#47
MateoGonzalezLourido wants to merge 2 commits into
Heroic-Games-Launcher:masterfrom
MateoGonzalezLourido:fix-worker

Conversation

@MateoGonzalezLourido

Copy link
Copy Markdown

Three related fixes to download_job_manager and _do_chunk_signing:

  1. Set self.running = False on TerminateWorkerTask

When download_job_manager receives a TerminateWorkerTask, it now sets self.running = False before breaking. This signals _do_chunk_signing to exit its loop cleanly instead of continuing to process chunks for a download that's already terminating.

  1. Make _do_chunk_signing interruptible on sign_pipe.recv()

Previously, sign_pipe.recv() could block indefinitely even after self.running was set to False. Replaced with a poll(1.0) loop that checks self.running on each iteration, so the thread exits cleanly within ≤1 second of receiving the terminate signal.

The poll(1.0) loop is not busy-wait — it blocks at the OS level until data arrives or the timeout expires. In the normal case the signing response arrives in milliseconds and the loop never iterates more than once. The only case where multiple iterations occur is during shutdown, where ≤1 second of latency is acceptable. A shorter timeout would only add more iterations with no benefit.
3. Set no_signed_chunks = True in the exception handler

When dl_worker_queue.put() raises an exception, the outer loop now waits before retrying instead of spinning in a tight retry loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant