-
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
Add application-level rate limits for crate updates, yanking and unyanking #6875
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
Turbo87
added
C-enhancement ✨
Category: Adding new behavior or a change to the way an existing feature works
A-backend ⚙️
labels
Jul 26, 2023
I was going to rebase the PR for you, but apparently you didn't check the "Maintainers are allowed to edit this pull request." checkbox... 😅
|
pietroalbini
force-pushed
the
pa-rate-limits-part2
branch
from
July 26, 2023 11:03
c138d0c
to
6635d95
Compare
Rebased. |
☔ The latest upstream changes (presumably #6892) made this pull request unmergeable. Please resolve the merge conflicts. |
Turbo87
reviewed
Jul 31, 2023
pietroalbini
force-pushed
the
pa-rate-limits-part2
branch
from
July 31, 2023 10:47
6635d95
to
68e8ee3
Compare
pietroalbini
force-pushed
the
pa-rate-limits-part2
branch
from
July 31, 2023 11:17
68e8ee3
to
7ef5ac8
Compare
Addressed all review comments. |
Turbo87
approved these changes
Aug 1, 2023
thanks! :) |
it looks like one of the tests is a little flaky :-/ |
This was referenced Aug 3, 2023
Turbo87
added a commit
to Turbo87/crates.io
that referenced
this pull request
Oct 17, 2023
The configuration for this nginx module was original added in rust-lang#1596, in combination with an IP-based `limit_req` rate limit. The rate limit was lately moved to the application layer (see rust-lang#6875). Since we no longer use the `limit_req` rate limit in the nginx config, it looks like we don't need the `real_ip` config anymore either.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-backend ⚙️
C-enhancement ✨
Category: Adding new behavior or a change to the way an existing feature works
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 follows up on #6872 by adding support for multiple kinds of rate limits in
RateLimiter
and adding a limit for yanking and unyanking, which would've prevented last Friday's outage.As I was already changing this code, I also moved the rate limit for publishing existing crates from nginx into the application. This makes the limit more precise (as it's not per-server anymore, potentially allowing up to 4x the limit), and allows overriding the limit just for a subset of users.
With this PR, the rate limits are:
Note that the environment variables also changed:
WEB_NEW_PKG_RATE_LIMIT_RATE_MINUTES
toRATE_LIMITER_PUBLISH_NEW_RATE_SECONDS
WEB_NEW_PKG_RATE_LIMIT_BURST
toRATE_LIMITER_PUBLISH_NEW_BURST