Conversation
Starting a second download used to kill the first. The eviction happens in handle_max_streams: play_stop is a per-source map of cancellation tokens shared by mpv playback and downloads, and with max_streams defaulting to 1 a new download would shift_remove_index(0) and cancel the running one. DownloadService now queues instead. download() pushes onto a queue and returns a promise that settles when the download actually finishes, fails or is cancelled, so existing callers need no changes, and the backend is only invoked once the channel's source has no download in flight. Queueing is per source_id to match how play_stop and max_streams are keyed, so separate sources still run in parallel without exceeding the limit. Also: - abortDownload drops a queued download from the queue rather than calling abort_download, which had no token to cancel and would have failed - cleanup and advancing the queue now happen only in run(), removing the double complete.next(true) and double unlisten on cancel - addDownload returns the existing entry for a duplicate id instead of overwriting it and leaking the first unlisten - the download manager shows queued entries as "Queued" with a striped bar Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Author
|
Closes #307 |
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.
No description provided.