2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-10 08:38:11 +08:00

PERF: introduce aggressive rate limiting for anonymous (#11129)

Previous to this change our anonymous rate limits acted as a throttle.
New implementation means we now also consider rate limited requests towards
the limit.

This means that if an anonymous user is hammering the server it will not be
able to get any requests through until it subsides with traffic.
This commit is contained in:
Sam 2020-11-05 16:36:17 +11:00 committed by GitHub
parent 6490fac881
commit 2686d14b9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 90 additions and 6 deletions

View file

@ -241,7 +241,8 @@ class Middleware::RequestTracker
"global_ip_limit_10_#{ip}",
GlobalSetting.max_reqs_per_ip_per_10_seconds,
10,
global: true
global: true,
aggressive: true
)
limiter60 = RateLimiter.new(
@ -249,7 +250,8 @@ class Middleware::RequestTracker
"global_ip_limit_60_#{ip}",
GlobalSetting.max_reqs_per_ip_per_minute,
60,
global: true
global: true,
aggressive: true
)
limiter_assets10 = RateLimiter.new(