Repository navigation
transport: refuse unbounded Retry-After waits (>24h / inf) when retry_budget_s is inf - #143
Merged
Merged
Conversation
Merged
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.
Fixes #139.
What changed
MAX_RETRY_WAIT_S = 86400.0(24 h) insaturate/transport.pyas the per-retryRetry-Afterlimit whenbudget_sis infinite (retry_budget_s=math.inf).call_endpoint(), whennot math.isfinite(budget)andresult.retry_afteris non-finite (e.g. overflowing delta-seconds"9"*400→float("inf")) or exceedsMAX_RETRY_WAIT_S(e.g.> 86400sor a far-future HTTP-date), fail the row immediately with an explicit error naming theRetry-Aftervalue and limit (e.g.http 429 (Retry-After inf exceeds 86400s limit): ..., keeping thehttp 429prefix forStats.error_counts).Retry-Afterwaits up to 24 h (including hourly and daily quotas) continue to be honoured with full1.0–1.2×upward jitter intact;next_wait()and all finitebudget_spaths are untouched.pump()'sretry_budget_sdocstring (saturate/__init__.py) and added an[Unreleased]entry inCHANGELOG.md.Verification
tests/test_transport_retry.pycovering overflowing delta-seconds ("9"*400),> 24h("86401"), far-future HTTP-date (2099), realasyncio.sleepnon-hang guard, hourly (3600s) and exact 24 h (86400s) boundary with jitter preserved, multi-attempt error/pressure/breaker preservation, moderateRetry-After+ backoff with recorded waits,Stats.error_counts(error_class) compatibility, and large finitebudget_s=200000regression.ruff check .,ruff format --check .,ty check saturate tests: all green.pytest tests/test_transport_retry.py: 56 passed.