Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DXCDT-541: Persistent rate limit handling #839

Merged
merged 4 commits into from
Sep 12, 2023

Conversation

willvedd
Copy link
Contributor

@willvedd willvedd commented Sep 11, 2023

🔧 Changes

The Auth0 CLI already has some solid retry logic when making requests to the Management API. By default, it will retry up to 5 times for 429s and 500s. This is fine for most cases, however with the addition of the tf generate command, many request could be made in a short period of time, occasionally making the retry logic insufficient.

This PR adds a bespoke handler that enables intelligent retries depending on HTTP status code. 429s are retried until they succeed while other error codes like 500s are retried a finite amount of times. This is the exact same logic that is used for the Terraform Provider (related).

Solves #420 by retrying on 502s.

📚 References

🔬 Testing

Unit test from #788 added. Manual verification with highly repetitive API requests that trigger flood of 429s.

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@willvedd willvedd requested a review from a team as a code owner September 11, 2023 17:48
@willvedd willvedd enabled auto-merge (squash) September 11, 2023 17:52
@willvedd willvedd merged commit 04992d8 into main Sep 12, 2023
@willvedd willvedd deleted the DXCDT-541-rate-limit-handling branch September 12, 2023 13:26
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