fix: resume revived paused tasks and guard unknown download sizes - #52
Conversation
Address review comments from #51: - Resume revived PAUSED tasks when the queue is active. The old ensureDownloadsAreRunning() workaround force-resumed them, but #51 removed it without a replacement, so tasks paused by the OS while backgrounded stayed paused forever after relaunch. - Guard progress fraction against bytesTotal <= 0. The downloader reports -1 when the server omits Content-Length, which produced negative fractionWritten values; report 0 instead while still passing raw byte counts through. - Update README install instructions to reference @fivecar/react-native-background-downloader instead of the old @kesha-antonov package. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 68493f45ab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
When init() is called with activeNetworkTypes (e.g. wifi-only) while on a forbidden network (e.g. cellular), the revived-PAUSED resume ran before init evaluated the initial network state, so a download could briefly run on metered data before onNetInfoChanged() paused it. Move the network-gating block ahead of the revive/start sections so pauseAllInternal() flips this.active off first; revivals then won't resume PAUSED tasks, revived DOWNLOADING tasks get paused, and fresh starts get paused in begin(). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_7e2fcf7a-2e23-4d00-817a-3d5dd89f9fc8) |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d843765. Configure here.
|
🎉 This PR is included in version 6.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
Addresses the three review-bot comments on #51, all verified as real issues:
ensureDownloadsAreRunning(), which previously force-resumed paused tasks on init. Without it, a task the OS paused while backgrounded stayed paused forever — the spec-start loop skips anything already inexistingTasks.reviveTask()now resumes a PAUSED task when the queue is active, keeping the pause-if-inactive branch.bytesTotalin progress. The downloader reportsbytesTotal: -1when the server omits Content-Length (AndroidProgressReporter.ktdocuments this; iOS passescountOfBytesExpectedToReceive).fractionWrittenis now 0 whenbytesTotal <= 0instead of negative/NaN; raw byte counts still pass through.@fivecar/react-native-background-downloader(the actual peer dependency since feat(deps)!: migrate to @fivecar/react-native-background-downloader #51) instead of the old@kesha-antonovpackage, with the iOS AppDelegate link fixed to the fork's Installation section.Test plan
startActive: false, and fraction 0 onbytesTotal: -1(each confirmed failing before the fix).tsc --noEmitand ESLint clean.🤖 Generated with Claude Code