Repository navigation
Conversation
calibrain#1420 gave a torrent 15 minutes to start and 15 minutes after each step forward. That suits a slow swarm, but someone else will want less or more. TORRENT_STALL_TIMEOUT_MINUTES (Download Clients, 5 to 60) sets it. The default is 15, so nothing changes. Five is the orchestrator's own stall timeout, so choosing it asks for nothing extra. The orchestrator's cap on a single activity grace goes from 16 minutes to an hour to leave room for the maximum.
grace_requested_at started at 0.0 and was compared against time.monotonic(). On a host that booted less than 10 minutes ago the first queued poll saw now - 0.0 < 600 and sent no grace. Start from None instead, and make the queue grace test run on a small clock so it no longer depends on uptime.
…the queue Leaving the client's queue releases the grace, which puts the stall deadline back to the orchestrator's 5 minutes. A torrent that had already used its start window, or was moving before the client requeued it, got no new window until its progress next went up. Reset the start window on release so the configured window applies again.
…rator timeout STALL_TIMEOUT_MIN_MINUTES was a second copy of 300 seconds. Put the number in download/activity.py, which has no imports, and have both the orchestrator and the settings module read it.
…he real one The stall setting is documented for torrents, but _poll_and_complete asked for the window on every protocol, so usenet downloads got it too. Only torrents ask for it now. The stall message always said 300s. Remember the size of the last grace a task asked for and report that, falling back to the default once it is released.
Contributor
Author
|
I pushed four small follow-up commits to this branch after going back over it.
|
This was referenced Oct 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#1420 gave a torrent 15 minutes to get going and 15 minutes after each step forward. That suits my swarms, but other people will want it shorter or longer, so this makes the number a setting.
TORRENT_STALL_TIMEOUT_MINUTESsits in Download Clients with the other torrent options and takes 5 to 60. The default is 15, so nothing changes unless someone sets it. 5 is the orchestrator's own stall timeout, so choosing it asks for no extra time and gives the old behaviour. The value can arrive as text from an env var, so anything that isn't a number falls back to the default and anything out of range is clamped.The orchestrator caps one activity grace at 16 minutes, so I raised that to an hour to fit the top of the range. As far as I can tell the protection bypass is the only caller that asks for more than a few minutes, but I haven't audited every caller. If you'd rather keep the cap, I can lower the maximum to 16 minutes instead.
Tests cover the default, 5 and 30, text values, out of range values and NaN, the start and movement windows following the setting, and the setting showing up in the Download Clients tab. I broke each rule on purpose to check a test catches it. The full suite fails the same tests with and without this change (the bypass and seleniumbase tests don't run in my environment).