summary refs log tree commit diff
path: root/synapse/handlers/profile.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-08-25 14:34:56 +0100
committerErik Johnston <erik@matrix.org>2017-08-25 14:34:56 +0100
commitbf81f3cf2c3e5b1d96953f3116c22aee05fb79b3 (patch)
treea87f982bf6763c263d45db6fcbef6cb9813d9015 /synapse/handlers/profile.py
parentAdd remote profile cache (diff)
downloadsynapse-bf81f3cf2c3e5b1d96953f3116c22aee05fb79b3.tar.xz
Split out profile handler to fix tests
Diffstat (limited to 'synapse/handlers/profile.py')
-rw-r--r--synapse/handlers/profile.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py
index 57e22edb0d..5e34501c7a 100644
--- a/synapse/handlers/profile.py
+++ b/synapse/handlers/profile.py
@@ -22,18 +22,21 @@ from synapse.api.errors import SynapseError, AuthError, CodeMessageException
 from synapse.types import UserID, get_domain_from_id
 from ._base import BaseHandler
 
-
 logger = logging.getLogger(__name__)
 
 
-class ProfileHandler(BaseHandler):
+class ProfileHandler(object):
     PROFILE_UPDATE_MS = 60 * 1000
     PROFILE_UPDATE_EVERY_MS = 24 * 60 * 60 * 1000
 
     def __init__(self, hs):
-        super(ProfileHandler, self).__init__(hs)
-
+        self.hs = hs
+        self.store = hs.get_datastore()
         self.clock = hs.get_clock()
+        self.ratelimiter = hs.get_ratelimiter()
+
+        # AWFUL hack to get at BaseHandler.ratelimit
+        self.base_handler = BaseHandler(hs)
 
         self.federation = hs.get_replication_layer()
         self.federation.register_query_handler(
@@ -194,7 +197,7 @@ class ProfileHandler(BaseHandler):
         if not self.hs.is_mine(user):
             return
 
-        yield self.ratelimit(requester)
+        yield self.base_handler.ratelimit(requester)
 
         room_ids = yield self.store.get_rooms_for_user(
             user.to_string(),