Update http status codes to retry request on #527
Merged
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 #525.
If this update makes sense we should probably update the other client libraries with similar logic. Happy to have feedback here on if this PR makes sense.
Updated the existing retry logic by adding more HTTP status codes that should trigger a request retry. The default urllib3 status codes to retry on are
413, 429, 503
. In this update, HTTP status codes to retry on has been updated to413, 429, 500, 502, 503, 504
via thestatus_forcelist
in the retry strategy, to accommodate a larger spectrum of server and client errors, especially those pertaining to temporary gateway or server issues.Default status codes to retry on:
Added these status codes:
Additionally, the
backoff_factor
was modified to0.1
to facilitate a gradual backoff between retries using0.0s, 0.2s, 0.4s, 0.8s, 1.6s, ...
. These modifications aim to improve the client retry logic against transient server problems and reliability of the client's HTTP requests in various situations.