Add a download-all action for the Next Up queue (issue #188) - #189
Merged
Conversation
Adds a download icon to the queue screen's top bar that starts a download for every episode currently in Next Up that isn't already downloaded or downloading, reusing EnclosureDownloadRepository the same way EpisodeListViewModel's own bulk-download action already does.
Tapping "download all" on a large Next Up queue enqueued dozens of EnclosureDownloadWorker jobs at once, each firing its HTTP request immediately and independently -- observed to make most of them fail (via IOException or a non-2xx response) and retry within about a second of starting, spread across as many distinct podcast-host CDNs. Downloads now route through a dedicated OkHttpClient whose Dispatcher caps concurrent requests at 3, queuing the rest instead of firing them all at once. The worker also switches from Call.execute() (synchronous, invisible to the Dispatcher's own limits) to an async await() so that cap actually takes effect. Confirmed on-device: before, a 30+ episode burst produced dozens of retries and almost no completions; after, downloads complete steadily with only occasional individual retries.
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.
Summary
QueueScreen's top bar (shown whenever the queue is non-empty) that starts a download for every queued episode not already downloaded or downloading, viaQueueViewModel.downloadAll().EnclosureDownloadRepository.startDownload, the same helperEpisodeListViewModel.downloadSelectedalready uses for its own bulk-download action, and shows the same "N downloads started" / "Already downloaded" snackbar feedback strings.Fixes #188
Test plan
./gradlew assembleDebug testDebugUnitTest lintDebugpassesQueueViewModelTest.downloadAll_startsDownloadForEveryEligibleQueuedEpisodeanddownloadAll_noEligibleEpisodes_reportsAlreadyDownloaded