-
Notifications
You must be signed in to change notification settings - Fork 611
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
Move new versions rate limits to the application #3790
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r? @jtgeibel (rust-highfive has picked a reviewer for you, use r? to override) |
Sorry for the big PR, I tried making it easy to review the PR commit-by-commit. |
pietroalbini
force-pushed
the
pa-rate-limit-updates
branch
from
July 18, 2021 21:07
e8d382b
to
1a5b0e8
Compare
Turbo87
added
A-backend ⚙️
C-internal 🔧
Category: Nonessential work that would make the codebase more consistent or clear
labels
Jul 19, 2021
Looks great! @bors r+ |
📌 Commit 1a5b0e8 has been approved by |
☀️ Test successful - checks-actions |
bors
added a commit
that referenced
this pull request
Aug 22, 2021
…pietroalbini Revert "Move new versions rate limits to the application" Reverts #3790 This has been causing issues in production 😢 see https://sentry.io/organizations/rust-lang/issues/2594868566/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-backend ⚙️
C-internal 🔧
Category: Nonessential work that would make the codebase more consistent or clear
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR refactors the rate limiting code to support more kinds of rate limits, and moves the new versions rate limit from nginx to the application. See #3780 for the rationale of this change.
The rate limiting for new publishes of existing crates is now tracked per-user instead of per-IP, with the ability to add overrides similar to the rate limiting for new crates. The limit is still the usual 1 version/min with a burst of 30, but in practice this could lower the rate limiting, as before the limit was between 30 and 60 depending how lucky users were with the load balancing.
PublishRateLimit
is now calledRateLimiter
, and for every operation it requires aLimitedAction
. This allows different rate limits to exist forLimitedAction::PublishNew
andLimitedAction::PublishExisting
, and adding new kinds of rate limits only requires adding a new enum variant.The environment variables to override the default rate limits changed to
RATE_LIMITING_{KIND}_RATE_SECONDS
andRATE_LIMITING_{KIND}_BURST
.There are two things that will be done in followup PRs:
action
column.publish_limit_buckets
torate_limit_buckets
andpublish_rate_overrides
torate_limit_overrides