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

chore(core): parse legacy rate limit if new rate limit not exist #7614

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

harukatab
Copy link
Contributor

@harukatab harukatab commented May 9, 2024

Description

What does the PR do? Include a concise description of the PR contents.

  • when the backend sends back only the old rate limit headers X-RateLimit-Remaining, it uses that without erroring out
  • The old rate limit doesn't send back X-RateLimit-Reset so it defaults to 0
  • if the backend sends back the new rate limit headers RateLimit-Remaining & RateLimit-Reset, SDK uses that values over legacy values

Testing

  • added unit test

@harukatab harukatab requested a review from a team as a code owner May 9, 2024 19:36
Copy link

codecov bot commented May 9, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 75.83%. Comparing base (e9cb82d) to head (085417b).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7614      +/-   ##
==========================================
+ Coverage   74.27%   75.83%   +1.55%     
==========================================
  Files         500      500              
  Lines       55642    54048    -1594     
==========================================
- Hits        41328    40987     -341     
+ Misses      13907    12651    -1256     
- Partials      407      410       +3     
Flag Coverage Δ
func 41.43% <ø> (+<0.01%) ⬆️
system 63.48% <45.45%> (+0.01%) ⬆️
unit 56.39% <90.90%> (+1.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
core/internal/api/ratelimitheaders.go 91.30% <90.90%> (+6.68%) ⬆️

... and 101 files with indirect coverage changes

Copy link
Member

@dmitryduev dmitryduev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!
Could you please fix linting? Kind of strange though, should have been caught by the pre-push hook (https://github.com/wandb/wandb/blob/main/CONTRIBUTING.md#linting-the-code)

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.

None yet

3 participants