Skip to content

feat(update): resume binary download with range requests and retry#45

Merged
damusix merged 1 commit into
masterfrom
feat/update-resumable-download
Jul 11, 2026
Merged

feat(update): resume binary download with range requests and retry#45
damusix merged 1 commit into
masterfrom
feat/update-resumable-download

Conversation

@damusix

@damusix damusix commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

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 HTTP Range request, instead of restarting the whole ~70MB.
  • Resume is guarded by If-Range/ETag: if the asset changed under us, the server returns 200 and we truncate and restart cleanly rather than stitching a stale prefix onto new bytes.
  • Permanent failures (404/403) fail fast — no pointless retries. Transient ones (408/429/5xx, stalls, resets) retry.
  • New update:retry event; 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.ts drives the real path against a live local HTTP server (no mocks): a stateful /resume endpoint streams a prefix then stalls, and asserts the retry sent Range: 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 a 404 fails fast with zero retries.

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.
@damusix damusix merged commit 883bcf3 into master Jul 11, 2026
4 checks passed
@damusix damusix deleted the feat/update-resumable-download branch July 11, 2026 20:34
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.

1 participant