Skip to content

Conversation

@matpimenta
Copy link
Contributor

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)

@trentrosenbaum trentrosenbaum self-requested a review December 3, 2024 15:22
@matpimenta matpimenta merged commit 7dcf80f into main Dec 3, 2024
3 checks passed
@matpimenta matpimenta deleted the handle-rate-limits branch December 3, 2024 16:43
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