-
Notifications
You must be signed in to change notification settings - Fork 10
Add rate limit to Port client #262
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
base: main
Are you sure you want to change the base?
Conversation
99b4284
to
01d6aa3
Compare
|
Code Coverage Artifact 📈: https://github.com/port-labs/terraform-provider-port-labs/actions/runs/15832472715/artifacts/3386161105Code Coverage Total Percentage:
|
🚨 The new code coverage percentage is lower than the current one. Current coverage: |
Code Coverage Artifact 📈: https://github.com/port-labs/terraform-provider-port-labs/actions/runs/15832678263/artifacts/3386278375Code Coverage Total Percentage:
|
🚨 The new code coverage percentage is lower than the current one. Current coverage: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 things I don't like about this PR:
- You are implementing a rate limit yourself which seems an unnecessary complication. I'm sure there are great libraries for something this important.
- The rate limit is set globally. Shouldn't it only affect retries on the same request?
internal/cli/models.go
Outdated
type RateLimitInfo struct { | ||
Limit int `json:"limit"` // x-ratelimit-limit | ||
Period int `json:"period"` // x-ratelimit-period | ||
Remaining int `json:"remaining"` // x-ratelimit-remaining | ||
Reset int `json:"reset"` // x-ratelimit-reset (seconds until reset) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add json
tags if we are not marshalling this model
2bc681c
to
889d9e2
Compare
Code Coverage Artifact 📈: https://github.com/port-labs/terraform-provider-port-labs/actions/runs/15846001956/artifacts/3390640592Code Coverage Total Percentage:
|
🚨 The new code coverage percentage is lower than the current one. Current coverage: |
Code Coverage Artifact 📈: https://github.com/port-labs/terraform-provider-port-labs/actions/runs/15846038502/artifacts/3390655240Code Coverage Total Percentage:
|
Description
What - Add rate limit capabilities to the base port http client
Why - Prevent failing on multiple 429
How - Add resty middle ware that detects rate limits and acts accordingly
Type of change
Please leave one option from the following and delete the rest: