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

[improvement] : Limit post calls to /v4/linode/instances endpoint #519

Merged
merged 7 commits into from
Sep 26, 2024

Conversation

rahulait
Copy link
Contributor

@rahulait rahulait commented Sep 23, 2024

What this PR does / why we need it:
This PR takes into account linode's 5 req/15 secs and 10 req/30 secs rate limits for POST to /v4/linode/instances endpoint.

We maintain count for number of requests made for each token and if we have used up all allowed requests, we'll wait until the limits reset. We rely on the response headers for counting how many more requests can be made and when the rate-limits will reset.
Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

Copy link

codecov bot commented Sep 23, 2024

Codecov Report

Attention: Patch coverage is 85.45455% with 8 lines in your changes missing coverage. Please review.

Project coverage is 65.50%. Comparing base (21b8cf2) to head (9b59006).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
controller/linodemachine_controller_helpers.go 64.70% 5 Missing and 1 partial ⚠️
controller/linodemachine_controller.go 33.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #519      +/-   ##
==========================================
+ Coverage   65.24%   65.50%   +0.25%     
==========================================
  Files          77       78       +1     
  Lines        4037     4090      +53     
==========================================
+ Hits         2634     2679      +45     
- Misses       1161     1167       +6     
- Partials      242      244       +2     

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

@rahulait rahulait force-pushed the limit-post-calls branch 4 times, most recently from 32797c8 to 57809a0 Compare September 24, 2024 12:58
@rahulait rahulait marked this pull request as ready for review September 24, 2024 12:59
config/manager/manager.yaml Show resolved Hide resolved
controller/linodemachine_controller.go Outdated Show resolved Hide resolved
controller/linodemachine_controller.go Outdated Show resolved Hide resolved
controller/linodemachine_controller.go Outdated Show resolved Hide resolved
amold1
amold1 previously approved these changes Sep 26, 2024
Copy link
Contributor

@amold1 amold1 left a comment

Choose a reason for hiding this comment

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

thanks for addressing the comments... lgtm!

@rahulait rahulait merged commit 01bf52a into main Sep 26, 2024
12 checks passed
@rahulait rahulait deleted the limit-post-calls branch September 26, 2024 20:10
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.

3 participants