fix: add polling interval to download progress loop - #306
Merged
starry-shivam merged 1 commit intoAug 1, 2026
Merged
Conversation
RudreshRajvansh
force-pushed
the
fix/download-poll-interval
branch
from
July 31, 2026 18:51
e964d58 to
c5a046e
Compare
Member
|
Thanks for reporting this and for creating a PR with the fix. |
starry-shivam
approved these changes
Aug 1, 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.
Description
The progress polling loop in
BookDownloader.downloadBookhad no delay, so it hitDownloadManager and allocated a new Cursor every iteration for the whole download.
Measured ~198 queries/sec on a Pixel.
Adds a 250ms wait between polls. It sits at the bottom of the loop behind
if (!isDownloadFinished), so the first progress update still goes out right away andfinishing doesn't get held up an extra 250ms.
Same phone and build, both successful downloads:
before: 796 iterations in 4022ms (~198/sec)
after: 16 iterations in 4083ms (~3.9/sec)
Related Issue
Closes #305
Type of change
Bug fix, though it's really cleanup. Nothing users would notice.
Pull Request checklist
download. Checked it by hand with a counter in the loop, numbers are in [Bug]: Download progress loop has no delay, polls DownloadManager ~200x/sec #305.