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

feat(client): V2 API client ratelimit improvements #519

Merged
merged 12 commits into from
Aug 1, 2024

Conversation

jharley
Copy link
Collaborator

@jharley jharley commented Aug 1, 2024

This change teaches the V2 API client to respond to HTTP429s by backing off using the Ratelimit headers in the API's response.

@codecov-commenter
Copy link

codecov-commenter commented Aug 1, 2024

Codecov Report

Attention: Patch coverage is 67.24138% with 19 lines in your changes missing coverage. Please review.

Project coverage is 78.57%. Comparing base (1c9409a) to head (ac2b603).

Files Patch % Lines
client/v2/client.go 21.42% 8 Missing and 3 partials ⚠️
client/v2/limits.go 85.71% 4 Missing and 2 partials ⚠️
client/client.go 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #519      +/-   ##
==========================================
- Coverage   78.63%   78.57%   -0.07%     
==========================================
  Files          72       73       +1     
  Lines        5557     5606      +49     
==========================================
+ Hits         4370     4405      +35     
- Misses        901      910       +9     
- Partials      286      291       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jharley jharley marked this pull request as ready for review August 1, 2024 13:29
@jharley jharley requested a review from a team as a code owner August 1, 2024 13:29
client/v2/limits.go Outdated Show resolved Hide resolved
client/v2/limits.go Outdated Show resolved Hide resolved
@jharley jharley requested a review from a team August 1, 2024 17:21
@jharley jharley merged commit cf2ca67 into main Aug 1, 2024
6 checks passed
@jharley jharley deleted the jharley.v2-client-ratelim-aware branch August 1, 2024 18:22
jharley added a commit that referenced this pull request Aug 1, 2024
I conflated the logic while hastily adding a test for jitter in #519.

This fixes that flakey test by separating the two paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

V2 API Client gracefully handles rate limits observing Rate-Limit headers
4 participants