Honour Retry-After on 429; cap and jitter the connect retry backoff - #321
Open
aminebalti55 wants to merge 2 commits into
Open
Honour Retry-After on 429; cap and jitter the connect retry backoff#321aminebalti55 wants to merge 2 commits into
aminebalti55 wants to merge 2 commits into
Conversation
A 429 was retried on a fixed local schedule (6s, 12s, 18s ...) and the Retry-After header was never read, so when the server asked for a longer cooldown the client kept probing on its own shorter one. Use the header, in either delta-seconds or HTTP-date form, as the floor for the backoff. Unparsable values are treated as absent so a bad header cannot make things worse than no header.
Both connectWithRetry loops slept 1<<attempts seconds with no cap and no jitter. Uncapped, that outgrows any sane wait within a couple of dozen failures; unjittered, every login that fails at the same moment retries in perfect lockstep thereafter. Share one helper that does both.
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.
httpclient: honour Retry-After on 429
A 429 was retried on a fixed local schedule (6s, 12s, 18s …) and the
Retry-Afterheader was never read, so when the server asked for a longer cooldown the client kept probing on its own shorter one. This uses the header — delta-seconds or HTTP-date — as the floor for the backoff. Unparsable values are treated as absent, so a bad header can't make things worse than no header. Test included.connector, igconnector: cap and jitter the connect retry backoff
Both
connectWithRetryloops slept1<<attemptsseconds with no cap and no jitter. Uncapped, that outgrows any sane wait within a couple of dozen failures; unjittered, every login that fails at the same moment retries in perfect lockstep thereafter. One shared helper inmetaiddoes both (5 min cap, ±20% jitter). Test included.Independent of #320. Both build and test clean; each commit self-contained.