feat(update): resume binary download with range requests and retry#45
Merged
Conversation
A stall or dropped connection now retries (up to 5 attempts with backoff) and resumes from the bytes on disk via an HTTP range request, guarded by If-Range/ETag so a changed asset restarts cleanly. Permanent errors like 404 fail fast; the CLI shows a resuming notice between attempts.
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
noorm update(binary path) now retries a stalled or dropped download (up to 5 attempts with backoff) and resumes from the bytes already on disk via an HTTPRangerequest, instead of restarting the whole ~70MB.If-Range/ETag: if the asset changed under us, the server returns200and we truncate and restart cleanly rather than stitching a stale prefix onto new bytes.404/403) fail fast — no pointless retries. Transient ones (408/429/5xx, stalls, resets) retry.update:retryevent; the CLI prints… — resuming (attempt N/M)between attempts.What this solves
Follow-up to the stall-timeout fix (#43): that stopped the infinite hang but discarded the partial and failed. On a flaky connection that meant re-pulling 68MB from zero every time. Now a stall costs only the tail.
Tests
tests/core/update/updater.test.tsdrives the real path against a live local HTTP server (no mocks): a stateful/resumeendpoint streams a prefix then stalls, and asserts the retry sentRange: bytes=<partial>-(a resume, not a restart) and the final file is byte-correct; plus retry-budget exhaustion emits the right number of notices, and a404fails fast with zero retries.