Ignore AS users when fetching push rules

By ignoring AS users early on when fetching push rules for a room we can
avoid needlessly hitting the DB and filling up the caches.
This commit is contained in:
Erik Johnston 2016-11-23 11:01:01 +00:00
parent baf9e74a73
commit 0163466d72
2 changed files with 18 additions and 2 deletions

View file

@ -39,6 +39,14 @@ class ApplicationServiceStore(SQLBaseStore):
def get_app_services(self):
return self.services_cache
def get_if_app_services_interested_in_user(self, user_id):
"""Check if the user is one associated with an app service
"""
for service in self.services_cache:
if service.is_interested_in_user(user_id):
return True
return False
def get_app_service_by_user_id(self, user_id):
"""Retrieve an application service from their user ID.