[DAR-5422][External] API-wide HTTP 429 and 5xx handling
#999
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.
Problem
Darwin recently introduced some API-wide rate limits. If they are exceeded, they will return an HTTP 429 error. Historically, darwin-py has not had handling for 429 errors, except for 1 specific functionality: Registering items from external storage
Solution
Resolve this by:
tenacity) to the genericget,post,put, anddeleteClientclass methodsWe also include the
500, 502, 503and504as codes that trigger retries - These were previously used to retry some requests in darwin-py as protection against temporary drops in external API servicesThere are some exceptions that are acceptable - Such as in
client.from_api_key()when creating aClientobject. This is because the back & retry code is applied toClientmethodsChangelog
Introduced API-wide rate limit and server error retry handling intro darwin-py