summary refs log tree commit diff
path: root/synapse/handlers/_base.py
diff options
context:
space:
mode:
authorPatrik Oldsberg <patrik.oldsberg@ericsson.com>2016-10-04 21:53:35 +0200
committerPatrik Oldsberg <patrik.oldsberg@ericsson.com>2016-10-06 15:24:59 +0200
commit2ff2d36b80dc03bda5185ff7fffbb9fdd0bf6e9a (patch)
treec96649f4d4ef4fcfd96496eb98c169039e06afc0 /synapse/handlers/_base.py
parentstorage/appservice: make appservice methods only relying on the cache synchro... (diff)
downloadsynapse-2ff2d36b80dc03bda5185ff7fffbb9fdd0bf6e9a.tar.xz
handers: do not ratelimit app service senders
Signed-off-by: Patrik Oldsberg <patrik.oldsberg@ericsson.com>
Diffstat (limited to 'synapse/handlers/_base.py')
-rw-r--r--synapse/handlers/_base.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/handlers/_base.py b/synapse/handlers/_base.py
index e58735294e..4981643166 100644
--- a/synapse/handlers/_base.py
+++ b/synapse/handlers/_base.py
@@ -55,8 +55,14 @@ class BaseHandler(object):
 
     def ratelimit(self, requester):
         time_now = self.clock.time()
+        user_id = requester.user.to_string()
+
+        app_service = self.store.get_app_service_by_user_id(user_id)
+        if app_service is not None:
+            return  # do not ratelimit app service senders
+
         allowed, time_allowed = self.ratelimiter.send_message(
-            requester.user.to_string(), time_now,
+            user_id, time_now,
             msg_rate_hz=self.hs.config.rc_messages_per_second,
             burst_count=self.hs.config.rc_message_burst_count,
         )