Skip to content

Conversation

simpixelated
Copy link
Contributor

@simpixelated simpixelated commented Jan 16, 2025

retryablehttp performs automatic retries under certain conditions

https://pkg.go.dev/github.com/hashicorp/go-retryablehttp

It's not clear to me if it will handle 429 by default, but it says this about the DefaultBackoff function:

DefaultBackoff provides a default callback for Client.Backoff which will perform exponential backoff based on the attempt number and limited by the provided minimum and maximum durations.

It also tries to parse Retry-After response header when a http.StatusTooManyRequests (HTTP Code 429) is found in the resp parameter. Hence it will return the number of seconds the server states it may be ready to process more requests from this client.

Tested locally by running public-api pointed to staging, but with the rate limit down to just 1 rpm.

Without the plugin (v1.2.2):
Screenshot 2025-01-22 at 3 43 29 PM

With the retryable plugin:
Screenshot 2025-01-22 at 3 43 42 PM

@simpixelated simpixelated marked this pull request as ready for review January 22, 2025 20:47
@simpixelated simpixelated requested a review from a team as a code owner January 22, 2025 20:47
@simpixelated simpixelated merged commit 18bbd80 into main Jan 23, 2025
17 checks passed
@simpixelated simpixelated deleted the APICS-2871/retry-429 branch January 23, 2025 16:07
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.

3 participants