summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorWill Hunt <will@half-shot.uk>2020-08-21 15:07:56 +0100
committerGitHub <noreply@github.com>2020-08-21 15:07:56 +0100
commitcbbf9126cbd2ace90c1c0f615b87bcec30fdcbd8 (patch)
tree8e8c14b9d64623dba4c5bcaafafa9ba4b2076e46 /synapse/handlers
parentMicro-optimisations to get_auth_chain_ids (#8132) (diff)
downloadsynapse-cbbf9126cbd2ace90c1c0f615b87bcec30fdcbd8.tar.xz
Do not apply ratelimiting on joins to appservices (#8139)
Add new method ratelimiter.can_requester_do_action and ensure that appservices are exempt from being ratelimited.

Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
Co-authored-by: Erik Johnston <erik@matrix.org>
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/room_member.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py
index 3a6ee6378d..a03cb02792 100644
--- a/synapse/handlers/room_member.py
+++ b/synapse/handlers/room_member.py
@@ -491,9 +491,10 @@ class RoomMemberHandler(object):
 
             if is_host_in_room:
                 time_now_s = self.clock.time()
-                allowed, time_allowed = self._join_rate_limiter_local.can_do_action(
-                    requester.user.to_string(),
-                )
+                (
+                    allowed,
+                    time_allowed,
+                ) = self._join_rate_limiter_local.can_requester_do_action(requester,)
 
                 if not allowed:
                     raise LimitExceededError(
@@ -502,9 +503,10 @@ class RoomMemberHandler(object):
 
             else:
                 time_now_s = self.clock.time()
-                allowed, time_allowed = self._join_rate_limiter_remote.can_do_action(
-                    requester.user.to_string(),
-                )
+                (
+                    allowed,
+                    time_allowed,
+                ) = self._join_rate_limiter_remote.can_requester_do_action(requester,)
 
                 if not allowed:
                     raise LimitExceededError(