Repository navigation
Cap how long monitoring can run - #9
Merged
Gabriel-Lewis merged 1 commit intoAug 30, 2026
Merged
Conversation
SLSKD_MONITOR_DURATION only gives up on a download that has stopped moving: any increase in bytes transferred resets its clock. A transfer trickling in a few bytes per tick therefore resets it forever, and since the playlist is built after monitoring returns, one slow peer could hold back all fifty tracks with nothing to bound it. SLSKD_MONITOR_MAX_RUNTIME caps the pass as a whole, defaulting to two hours. On expiry the monitor stops and returns without an error, so the playlist is still built from whatever finished; only the tracks still in flight are lost, which is what already happens to a skipped track. 0 disables the cap for anyone who would rather wait. The cap also bounds the release migration added alongside it, since that is checked inside the same loop. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 30, 2026
This was referenced Aug 30, 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.
Audit finding 3.
Stacked on #7 — the cap has to bound the release-migration retry loop too, and that only exists there. Base is
fix/album-sibling-migration; it retargets todevautomatically once #7 merges. #8 also touchesmonitor.go, so whichever of the three lands last needs a small rebase.The bug
SLSKD_MONITOR_DURATION(15 min) only gives up on a download that has stopped moving —monitor.goresets its clock on any increase in bytes transferred. A transfer trickling in a few bytes per tick resets it forever.Because the playlist is built after monitoring returns, one slow peer could hold back all 50 tracks indefinitely, with nothing bounding the loop.
The fix
SLSKD_MONITOR_MAX_RUNTIMEcaps the whole pass, defaulting to 120 minutes. On expiry the monitor stops and returns without an error, so the playlist is still built from whatever finished — only tracks still in flight are lost, which is already what happens to a skipped track.0disables the cap.Documented in both
sample.envfiles. Note that its siblings (SLSKD_MONITOR_INTERVAL,SLSKD_MONITOR_DURATION) aren't documented there either; I only added the new one rather than expanding scope.Testing
MonitorDownloads never returned; the time limit did not applyafter hanging the full 5s timeout.0disables it, verified across several ticks so a zero deadline can't be mistaken for "already expired".go build ./...,go vet ./src/...,go test ./src/...pass.🤖 Generated with Claude Code