summary refs log tree commit diff
path: root/synapse/handlers/_base.py
diff options
context:
space:
mode:
authorLuke Barnard <lukeb@openmarket.com>2016-10-20 11:43:05 +0100
committerLuke Barnard <lukeb@openmarket.com>2016-10-20 11:43:05 +0100
commit1b17d1a106604ddf1d8b97d499db8de1dc0651b5 (patch)
tree717e4235947ac2ea32ec8c5036a7bcd29373bba3 /synapse/handlers/_base.py
parentAllow Configurable Rate Limiting Per AS (diff)
downloadsynapse-1b17d1a106604ddf1d8b97d499db8de1dc0651b5.tar.xz
Use real AS object by passing it through the requester
This means synapse does not have to check if the AS is interested, but instead it effectively re-uses what it already knew about the requesting user
Diffstat (limited to 'synapse/handlers/_base.py')
-rw-r--r--synapse/handlers/_base.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/synapse/handlers/_base.py b/synapse/handlers/_base.py
index a377b1225b..ba62746214 100644
--- a/synapse/handlers/_base.py
+++ b/synapse/handlers/_base.py
@@ -65,14 +65,9 @@ class BaseHandler(object):
         if app_service is not None:
             return  # do not ratelimit app service senders
 
-        should_rate_limit = True
-
-        for service in self.store.get_app_services():
-            if service.is_interested_in_user(user_id):
-                should_rate_limit = service.is_rate_limited()
-                break
-
-        if not should_rate_limit:
+        if requester.as_user and not requester.as_user.is_rate_limited():
+            # do not ratelimit users of which a non-rate-limited AS is
+            # acting on behalf
             return
 
         allowed, time_allowed = self.ratelimiter.send_message(