From 2617452444d8d2b7bc8343c59ccb6f4626ec001f Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 9 Jul 2024 11:35:13 -0600 Subject: [PATCH 1/2] Fix docs on `record_action` to clarify the actions are applied 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. --- synapse/api/ratelimiting.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/synapse/api/ratelimiting.py b/synapse/api/ratelimiting.py index 26b8711851..b80630c5d3 100644 --- a/synapse/api/ratelimiting.py +++ b/synapse/api/ratelimiting.py @@ -236,9 +236,8 @@ def record_action( requester: The requester that is doing the action, if any. key: An arbitrary key used to classify an action. Defaults to the requester's user ID. - n_actions: The number of times the user wants to do this action. If the user - cannot do all of the actions, the user's action count is not incremented - at all. + n_actions: The number of times the user performed the action. May be negative + to "refund" the rate limit. _time_now_s: The current time. Optional, defaults to the current time according to self.clock. Only used by tests. """ From 3d8d3305b2e251c910447c69f8f3875d883103cc Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 9 Jul 2024 12:11:58 -0600 Subject: [PATCH 2/2] Changelog --- changelog.d/17426.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/17426.misc diff --git a/changelog.d/17426.misc b/changelog.d/17426.misc new file mode 100644 index 0000000000..886e5d4389 --- /dev/null +++ b/changelog.d/17426.misc @@ -0,0 +1 @@ +Fix documentation on `RateLimiter#record_action`. \ No newline at end of file