-
Notifications
You must be signed in to change notification settings - Fork 11
feat!: introduce rate limiting #42
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
Merged
Merged
Conversation
This file contains 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
This will allow us to control the concurrency of requests made through the client at a later date.
Has a default concurrency of 50, but is configurable in the TwilioServerlessApiClient constructor.
Got already has retry capabilities, with back off, built in. Default number of retries is 2, so this increases to 10. It also only retries on certain HTTP statuses (including 429) and other network errors.
Since we no longer pass the GotClient around, adding the ClientConfig to it doesn't help. Instead, we pass the config to functions that need it.
dkundel
suggested changes
May 20, 2020
Btw it seems also like the docs are failing to generate: https://app.netlify.com/sites/twilio-serverless-api/deploys/5ec348c7d323bd000726519e |
Can configure in constructor or environment.
Don't know what was up with the docs, but we're good now @dkundel. Also I'll open an issue about splitting the |
dkundel
approved these changes
May 21, 2020
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.
This centralises calls to
got
in theTwilioServerlessApiClient
. Instead of making calls directly on thegot
client, we now make calls through theTwilioServerlessApiClient
'srequest
method. This allows us to add concurrency limiting and retry logic to those calls in a central place.p-limit
to limit concurrency with a default level of 50 concurrent calls (Twilio limit is 100)got
to retry failed calls with a limit of 10 retries (got
only retries specific failures including 429 errors)Fixes #37.
Contributing to Twilio