Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix incorrect docstring for Ratelimiter. (#16255)
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep authored Sep 5, 2023
1 parent 79aa269 commit a2b8814
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.d/16255.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix incorrect docstring for `Ratelimiter`.
7 changes: 4 additions & 3 deletions synapse/api/ratelimiting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__(
Expand Down

0 comments on commit a2b8814

Please sign in to comment.