Skip to content

Conversation

@mattt
Copy link
Contributor

@mattt mattt commented Aug 4, 2023

Related to #114

This PR introduces a new withAutomaticRetry function that wraps requests made with fetch to automatically retry them as appropriate (429 status code, as well as 5xx errors for GET requests). If the server sends a Retry-After header, that value is used. Otherwise, the function delays for a configured interval with exponential backoff and jitter.

This should all be in line with the retry logic in the Python client.

@mattt mattt requested a review from nickstenning August 4, 2023 13:05
@mattt mattt marked this pull request as draft August 4, 2023 13:08
@mattt
Copy link
Contributor Author

mattt commented Aug 4, 2023

Holding in draft until we have test coverage.

@mattt mattt force-pushed the mattt/retry-policy branch from 78f6280 to dc1fbd2 Compare August 7, 2023 11:32
@mattt mattt force-pushed the mattt/retry-policy branch from dc1fbd2 to 0975aa2 Compare August 7, 2023 12:44
@mattt mattt marked this pull request as ready for review August 7, 2023 12:45
@mattt mattt merged commit 533b26d into main Aug 7, 2023
@mattt mattt deleted the mattt/retry-policy branch August 7, 2023 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants