fix: Retry Cloudflare origin errors (520-524) from api.paddle.com - #161
Open
cpruijsen wants to merge 1 commit into
Open
fix: Retry Cloudflare origin errors (520-524) from api.paddle.com#161cpruijsen wants to merge 1 commit into
cpruijsen wants to merge 1 commit into
Conversation
api.paddle.com is served through Cloudflare, which returns 520-524 for origin-side problems (522 = origin connection timeout). These were not in the retry status_forcelist, so transient origin errors were never retried even though retry_count defaults to 3. Closes PaddleHQ#157
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.
build_request_sessioninpaddle_billing/Client.pyretries on[429, 500, 502, 503, 504], which leaves out the Cloudflare originerror range.
api.paddle.comsits behind Cloudflare, so a 522 origin connection timeout reaches thecaller as a hard failure on the first attempt while a 502 from the same incident is retried. These are
transient by definition, which is what the retry policy exists for.
This adds 520 through 524 to
status_forcelist.totalandbackoff_factorare untouched, so thenumber of attempts and the delay between them are unchanged for the codes already listed.
The case added to
tests/Functional/Client/test_Client.pyasserts the mounted adapter'sstatus_forcelistrather than the constructorargument, so it fails if the policy stops reaching the adapter as well as if the list changes.
Fixes #157