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

Handle API rate limits gracefully #191

Closed
wants to merge 1 commit into from
Closed

Conversation

matpimenta
Copy link
Collaborator

This PR adds the following to the SDK:

  1. Limits the number of requests to 400 per minute as per docs. The SDK waits for the next window to send more requests. It allows bursting, so it doesn't slow down requests under the limits; however, it will block when the limit is reached. It also considers the header X-Rate-Limit-Remaining to adjust the request count according to the server.
  2. In case the API returns 429 Too Many Request, the SDK will retry the request using exponential backoff, with a maximum delay of 1 minute (matching the 1-minute window)

@matpimenta matpimenta marked this pull request as ready for review December 3, 2024 10:18
@CLAassistant
Copy link

CLAassistant commented Dec 3, 2024

CLA assistant check
All committers have signed the CLA.

@matpimenta matpimenta closed this Dec 3, 2024
@matpimenta matpimenta reopened this Dec 3, 2024
@matpimenta
Copy link
Collaborator Author

@cla-bot check

@matpimenta matpimenta closed this Dec 3, 2024
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