Skip to content

fix: add polling interval to download progress loop - #306

Merged
starry-shivam merged 1 commit into
Pool-Of-Tears:mainfrom
RudreshRajvansh:fix/download-poll-interval
Aug 1, 2026
Merged

fix: add polling interval to download progress loop#306
starry-shivam merged 1 commit into
Pool-Of-Tears:mainfrom
RudreshRajvansh:fix/download-poll-interval

Conversation

@RudreshRajvansh

Copy link
Copy Markdown
Contributor

Description

The progress polling loop in BookDownloader.downloadBook had no delay, so it hit
DownloadManager 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 and
finishing 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

@RudreshRajvansh
RudreshRajvansh force-pushed the fix/download-poll-interval branch from e964d58 to c5a046e Compare July 31, 2026 18:51
@starry-shivam

Copy link
Copy Markdown
Member

Thanks for reporting this and for creating a PR with the fix.

@starry-shivam
starry-shivam merged commit dd3af60 into Pool-Of-Tears:main Aug 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Download progress loop has no delay, polls DownloadManager ~200x/sec

2 participants