diff options
author | Patrick Cloke <patrickc@matrix.org> | 2023-09-06 13:08:22 -0400 |
---|---|---|
committer | Patrick Cloke <patrickc@matrix.org> | 2023-09-06 13:08:22 -0400 |
commit | 32fb264120f36bdcd47598457d8a2eb10a3f7a5e (patch) | |
tree | b256b054994eda9e63e27cf1c7b4fd1dab01af37 /synapse/api/ratelimiting.py | |
parent | Apply missed suggestions from the review of #16090. (#16263) (diff) | |
parent | Add back newsfile from #16258. (diff) | |
download | synapse-32fb264120f36bdcd47598457d8a2eb10a3f7a5e.tar.xz |
Merge remote-tracking branch 'origin/release-v1.92' into develop
Diffstat (limited to 'synapse/api/ratelimiting.py')
-rw-r--r-- | synapse/api/ratelimiting.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/synapse/api/ratelimiting.py b/synapse/api/ratelimiting.py index 887b214d64..02ae45e8b3 100644 --- a/synapse/api/ratelimiting.py +++ b/synapse/api/ratelimiting.py @@ -40,7 +40,7 @@ class Ratelimiter: - the cost C of this request in tokens. Then, if there is room in the bucket for C tokens (T + C <= `burst_count`), the request is permitted and `cost` tokens are added to the bucket. - Otherwise the request is denied, and the bucket continues to hold T tokens. + Otherwise, the request is denied, and the bucket continues to hold T tokens. This means that the limiter enforces an average request frequency of `rate_hz`, while accumulating a buffer of up to `burst_count` requests which can be consumed @@ -55,9 +55,10 @@ class Ratelimiter: request. Args: + store: The datastore providing get_ratelimit_for_user. clock: A homeserver clock, for retrieving the current time - rate_hz: The long term number of actions that can be performed in a second. - burst_count: How many actions that can be performed before being limited. + cfg: The ratelimit configuration for this rate limiter including the + allowed rate and burst count. """ def __init__( |