Repository navigation
Don't lose a playlist to one failed status poll - #8
Merged
Merged
Conversation
Monitoring ended for every track at once whenever a status poll failed, and tracks that never reach Present are dropped before the playlist is built. One blip -- a restarted slskd, a dropped connection -- therefore cost every download still in flight. Two things caused it. The monitor treated any error from GetDownloadStatus as fatal, and slskd's implementation returned an error when it found nothing to report, which is the normal state a minute after queueing rather than a failure. The first poll happens one CheckInterval after the downloads are queued, so a slskd that had not yet surfaced the transfers ended the run before it had begun. An empty result is now just an empty result; the monitor already decides for itself how long to wait for a file to appear. Genuine request failures are still reported, but the monitor rides out up to three in a row before giving up, and a success resets the budget so unrelated blips spread across a long run do not accumulate into one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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 findings 1 and 2 — they're the same bug, so they're fixed together.
The bug
MonitorDownloadstreated any error fromGetDownloadStatusas fatal and returned immediately, ending monitoring for every track at once. SincefilterLocalTrackskeeps only tracks markedPresent, everything still downloading was then dropped before the playlist was built.What made it fire in ordinary operation: slskd's
GetDownloadStatusreturnedno files found to monitorwhen the status map came back empty — conflating "nothing queued yet" with "the request failed." The first poll happens oneSLSKD_MONITOR_INTERVAL(default 1 minute) after queueing, so a slskd that hadn't yet surfaced its transfers ended the run before it started.The fix
Testing
Six tests, all mutation-checked by reverting to the old behaviour — each one fails with the old code:
want nil after recovering)go build ./...,go vet ./src/...,go test ./src/...pass.🤖 Generated with Claude Code