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
This commit is contained in:
Luke Barnard 2016-10-20 11:43:05 +01:00
parent 5b54d51d1e
commit 1b17d1a106
3 changed files with 15 additions and 18 deletions

View file

@ -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(