Conversation
Contributor
Author
|
@yegor256 take a look please, happy to clarify anything about this change. |
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.
Fbe::Middleware::RateLimitstored the response of/rate_limitbefore looking at its status. One 5xx was then served from the cache to every lateroff_quota?, the client answered "off quota" for the rest of the process, and the retries never reached GitHub. With an HTML error body the parse raisedJSON::ParserErroron every call, as #1225 shows.Now a response of
/rate_limitis cached and parsed only when it is a success. An error is passed on as it is, without touching the cache or the counters, so the retry and the next quota check ask GitHub again, and an error body is never parsed.The middleware tests cover a random 5xx and a client error followed by a 200, an error with an HTML body, and a remaining count that stays unknown after an error. One more test in
test_octo.rbgoes throughFbe.octowith a token, a 502 with HTML and then a 200, and checks that arepositorycall gets through.Closes #1225