summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-08-17 15:24:16 +0100
committerErik Johnston <erik@matrix.org>2018-08-17 15:26:13 +0100
commit91cdb6de08aa20f2bc7f8df906eb5b56df387309 (patch)
tree9a875a1fb049311d1b351bcb1d87f0ab91e49326 /synapse/handlers
parentMerge branch 'develop' of github.com:matrix-org/synapse into erikj/split_prof... (diff)
downloadsynapse-91cdb6de08aa20f2bc7f8df906eb5b56df387309.tar.xz
Call UserDirectoryHandler methods directly
Turns out that the user directory handling is fairly racey as a bunch
of stuff assumes that the processing happens on master, which it doesn't
when there is a synapse.app.user_dir worker. So lets just call the
function directly until we actually get round to fixing it, since it
doesn't make the situation any worse.
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/profile.py26
1 files changed, 5 insertions, 21 deletions
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py
index 8b349f6ad6..3e1d95d5e5 100644
--- a/synapse/handlers/profile.py
+++ b/synapse/handlers/profile.py
@@ -25,7 +25,6 @@ from synapse.api.errors import (
     SynapseError,
 )
 from synapse.metrics.background_process_metrics import run_as_background_process
-from synapse.replication.http.profile import ReplicationHandleProfileChangeRestServlet
 from synapse.types import UserID, get_domain_from_id
 
 from ._base import BaseHandler
@@ -47,10 +46,6 @@ class WorkerProfileHandler(BaseHandler):
 
         self.user_directory_handler = hs.get_user_directory_handler()
 
-        self._notify_master_profile_change = (
-            ReplicationHandleProfileChangeRestServlet.make_client(hs)
-        )
-
     @defer.inlineCallbacks
     def get_profile(self, user_id):
         target_user = UserID.from_string(user_id)
@@ -166,16 +161,10 @@ class WorkerProfileHandler(BaseHandler):
         )
 
         if self.hs.config.user_directory_search_all_users:
-            if self.hs.config.worker_app is None:
-                profile = yield self.store.get_profileinfo(target_user.localpart)
-                yield self.user_directory_handler.handle_local_profile_change(
-                    target_user.to_string(), profile
-                )
-            else:
-                yield self._notify_master_profile_change(
-                    requester=requester,
-                    user_id=target_user.to_string(),
-                )
+            profile = yield self.store.get_profileinfo(target_user.localpart)
+            yield self.user_directory_handler.handle_local_profile_change(
+                target_user.to_string(), profile
+            )
 
         yield self._update_join_states(requester, target_user)
 
@@ -225,16 +214,11 @@ class WorkerProfileHandler(BaseHandler):
             target_user.localpart, new_avatar_url
         )
 
-        if self.hs.config.worker_app is None:
+        if self.hs.config.user_directory_search_all_users:
             profile = yield self.store.get_profileinfo(target_user.localpart)
             yield self.user_directory_handler.handle_local_profile_change(
                 target_user.to_string(), profile
             )
-        else:
-            yield self._notify_master_profile_change(
-                requester=requester,
-                user_id=target_user.to_string(),
-            )
 
         yield self._update_join_states(requester, target_user)