Repository navigation
fix(examples): retry the Wireshark sample downloads on 429, 5xx and timeouts (#1658) - #1659
Merged
Merged
Conversation
…imeouts (#1658) - _download made one attempt, so an HTTP 429 on 9df91d4 sent Integration Python 3.11 straight to the offline stand-in. HTTP 429, 5xx and timeouts are now retried: 3 attempts, 2 s backoff doubling, or the Retry-After header (seconds or HTTP-date), with at most 30 s of waiting per download. A Retry-After past that budget ends the retries instead of being cut short. - Other 4xx and unreachable hosts still fail at once. Each retry is logged on stderr. The SHA-256 check and the stand-in fallback are unchanged. New tests/project/test_pcapng_download_retry_1658_unit.py stubs urlopen and the clock: 429 then success, Retry-After in both forms, the budget and its inclusive edge, 404 not retried, 500 and 599 retried, and exhausted retries falling back to the stand-in. The -0000 date test pins TZ off UTC. All 8 fail against the old generator; 8 pass with the fix. Closes #1658
Owner
Author
|
Verdict: GOOD TO GO at |
Contributor
|
Coverage: 89.66% (unit tier, Python 3.14,
Per-file detail: the |
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.
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeAdded a changelog entry under
docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible — N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
Tick the commit type your subject line carries.
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elseDescription of your pull request and other information
_download(examples/generators/pcapng.py:876) now retries HTTP 429, 5xx and timeouts: 3 attempts, 2 s backoff doubling, or theRetry-Afterheader (seconds or HTTP-date), with at most 30 s of waiting per download. ARetry-Afterpast that budget ends the retries rather than being cut short. Other 4xx and unreachable hosts still fail at once, so an offline run is as quick as before. Each retry is logged on stderr; the SHA-256 check and the stand-in fallback are unchanged. Only the waiting is bounded:urlopen's 30 s timeout applies per socket operation, not per attempt.New
tests/project/test_pcapng_download_retry_1658_unit.pystubsurlopenand the clock: 429 then success,Retry-Afterin both forms, the budget and its inclusive edge, 404 not retried, 500 and 599 retried, exhausted retries falling back to the stand-in. The-0000date test pinsTZ=America/New_York, since on a UTC host the bug it guards cannot show. All 8 fail against the old generator. The 404 test fails there only on its 429, 5xx and timeout control rows, since the old code retried nothing. Also green:tests/test_support_helpers.py,tests/project/test_generators_import_their_own_tree.py,test_isort_clean.py.Closes #1658