Skip to content

Make save_large_file robust to transient errors - #351

Closed
Sriram-Nambiar wants to merge 2 commits into
openzim:mainfrom
Sriram-Nambiar:issue-348-save-large-file-retries
Closed

Sriram-Nambiar wants to merge 2 commits into
openzim:mainfrom
Sriram-Nambiar:issue-348-save-large-file-retries

Conversation

@Sriram-Nambiar

Copy link
Copy Markdown
Contributor

Replace wget with streaming requests and Range-based resume in save_large_file, fixing #348.

wget treats transient HTTP errors (502/503/504/429) and DNS failures as fatal, and its -t counter is a budget for the entire download rather than consecutive failures without progress.

This matches the solution settled in openzim/zimwright#7:

  • Resumes downloads using HTTP Range requests from the bytes on disk.
  • Only counts attempts that make no progress toward the retry limit.
  • Enforces explicit connect (30s) and read (60s) timeouts to avoid streaming hangs.
  • Retries transient HTTP errors (429, 500, 502, 503, 504) and connection/timeout errors with backoff and jitter.
  • Restarts cleanly from scratch if the server ignores Range (200 OK).

Unit tests added covering all resume, retry, and failure scenarios.

Closes #348.

@Sriram-Nambiar Sriram-Nambiar changed the title Make save_large_file robust to transient errors with progress-based r… Make save_large_file robust to transient errors Oct 15, 2026
@benoit74

Copy link
Copy Markdown
Collaborator

@Sriram-Nambiar this is a duplicate of #349 ; I will hence close this PR in favor of the other one. I strongly recommend to comment on issue to be assigned before starting work, this avoids this kind of duplicate effort.

I encourage you to contribute to #349 by reviewing code changes over there.

Please also do not merge from main to feature branch, this is against our practices and just adds noise (if you really need a change done in main, then you have to rebase and force push ; if review is OK, then you rebase and force push ; otherwise, you keep the branch a bit outdated, this eases the review process)

@benoit74 benoit74 closed this Oct 19, 2026
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.

save_large_file downloads are not robust to transient HTTP/host errors

2 participants