Repository navigation
Conversation
Retry HTTP 502, 503 and 504 responses up to three times, including when Retry-After is absent. Preserve DownloadHTTPError and its status code when retries are exhausted. Add regression tests for recovery, exhausted retries and non-retryable responses. Fixes theupdateframework#3044 Signed-off-by: saurav kumar <krsauvi@gmail.com>
Sauvi72
marked this pull request as ready for review
November 22, 2026 19:01
Author
|
@jku, could you review this fix for #3044 and approve the workflow runs? They currently report action_required. Local tox passes all 211 tests, coverage, lint/type checks and the documentation build. The tests cover recovery from 502/503/504, retry exhaustion preserving DownloadHTTPError, and errors that should not be retried. |
This branch has not been deployed
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.
Description of the changes being introduced by the pull request:
Urllib3Fetcher uses urllib3's default retry policy, which does not retry HTTP 502, 503 or 504 responses without a Retry-After header. A transient gateway or service failure therefore ends the download immediately.
Configure the existing pool managers to retry these status codes up to three times. Return the last response when retries are exhausted so the fetcher continues to raise DownloadHTTPError with the HTTP status code. Document the retry behavior on Urllib3Fetcher.
Regression tests exercise urllib3's retry loop with simulated HTTP responses. They cover recovery for each status, exhaustion after four attempts, and no retries for 400, 403, 404 and 500 without Retry-After. The recovery and exhaustion cases fail against develop and pass with this change.
Validation: tox passes (211 tests, 98% coverage, Ruff, mypy, zizmor and Sphinx documentation build), using Python 3.14 on macOS.
Fixes #3044