Repository navigation
Retry HTTP 429 responses (httpbin.org rate limit) - #3
Merged
Merged
Conversation
httpbin.org now limits clients to 2 requests per second and answers the rest with 429 Too Many Requests. The tests send requests about 10 ms apart, so on the fast Ubuntu runner Callback.cpp's POST test got the 429 body and failed its "sensor" check. - AsyncHttp retries a 429 up to 3 times, waiting for Retry-After (capped at 5 s) or 1 s. SetRateLimitRetry() changes or disables it. - HttpGet/HttpPost share the request loop in Perform(). - New test: httpbin.org/status/429 is retried, then returned. - The POST callback test prints the status, error and body on failure. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
httpbin.org now limits each client to 2 requests per second and answers the rest with
429 Too Many Requests. The unit tests send requests about 10 ms apart. On the fast Ubuntu runner,Callback.cpp's POST test got the 429 body instead of the echo and failed its"sensor"check at line 104. That happened on PR #2 and again after the merge onmain.AsyncHttpretries a 429 up to 3 times on the worker thread. It waits for the server'sRetry-After(capped at 5 s) or 1 s, then returns the last response.SetRateLimitRetry(maxRetries, retryDelay)changes the retry count and delay; 0 retries turns it off. The@notesays a rate-limited request holds up the requests queued behind it.HttpGet/HttpPostshare the request loop in a privatePerform().Blocking.cppTest 7 sendshttpbin.org/status/429. It checks that the request is retried (time taken ≥ 2 × delay), then returned as a 429, and that0returns it at once.🤖 Generated with Claude Code