Fix incorrect docstring for Ratelimiter. (#16255)

This commit is contained in:
Patrick Cloke 2023-09-05 12:11:05 -04:00 committed by GitHub
parent 79aa26936f
commit a2b8814d64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

1
changelog.d/16255.misc Normal file
View File

@ -0,0 +1 @@
Fix incorrect docstring for `Ratelimiter`.

View File

@ -40,7 +40,7 @@ class Ratelimiter:
- the cost C of this request in tokens. - the cost C of this request in tokens.
Then, if there is room in the bucket for C tokens (T + C <= `burst_count`), 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. 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`, 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 while accumulating a buffer of up to `burst_count` requests which can be consumed
@ -55,9 +55,10 @@ class Ratelimiter:
request. request.
Args: Args:
store: The datastore providing get_ratelimit_for_user.
clock: A homeserver clock, for retrieving the current time clock: A homeserver clock, for retrieving the current time
rate_hz: The long term number of actions that can be performed in a second. cfg: The ratelimit configuration for this rate limiter including the
burst_count: How many actions that can be performed before being limited. allowed rate and burst count.
""" """
def __init__( def __init__(