Skip to content

Commit 677142b

Browse files
authored
Fix docs on record_action to clarify the actions are applied (#17426)
This looks like a copy/paste error: the function doesn't reject anything, but instead allows the action count to go through regardless. The remainder of the function's documentation appears correct.
1 parent 342f0c3 commit 677142b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

changelog.d/17426.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix documentation on `RateLimiter#record_action`.

synapse/api/ratelimiting.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,8 @@ def record_action(
236236
requester: The requester that is doing the action, if any.
237237
key: An arbitrary key used to classify an action. Defaults to the
238238
requester's user ID.
239-
n_actions: The number of times the user wants to do this action. If the user
240-
cannot do all of the actions, the user's action count is not incremented
241-
at all.
239+
n_actions: The number of times the user performed the action. May be negative
240+
to "refund" the rate limit.
242241
_time_now_s: The current time. Optional, defaults to the current time according
243242
to self.clock. Only used by tests.
244243
"""

0 commit comments

Comments
 (0)