WIP: Add automatic retry attempts when the API retry limit is reached#335
Draft
tiagolupepic wants to merge 2 commits intomainfrom
Draft
WIP: Add automatic retry attempts when the API retry limit is reached#335tiagolupepic wants to merge 2 commits intomainfrom
tiagolupepic wants to merge 2 commits intomainfrom
Conversation
This commit introduces the with_retry_limit method to auto retry when a api responds with 409 (rate limit reached). For now, the values of number of retries are arbitrary and the time to wait as well.
Welcome back, @tiagolupepic!It looks like we still need your CLA signature on file. Please sign it here: Once signed, this PR will be automatically updated. |
Thanks, @tiagolupepic! 🎉Your CLA has been signed and is now on file. We'll proceed with the review shortly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This pull request introduces automatic retry logic for API requests that receive a 429 (Too Many Requests) response
Changes
Lago::Api::RetryLimitErrorclass to represent retryable errors, and updated the client to raise this error on 429 responses (lib/lago/api/retry_limit_error.rb,lib/lago/api/connection.rb)with_retry_limitmethod that retries failed requests up to three times with a configurable wait time, and applied this logic to all HTTP methods (get,get_all,put,patch,destroy).