diff options
author | Erik Johnston <erik@matrix.org> | 2018-10-26 16:22:45 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2018-10-26 16:22:45 +0100 |
commit | 03e634dad4cd1014f609ece9574df7a24f1ec254 (patch) | |
tree | a9f4a53a03bb0205e616ce7cf741fdbd15d4fcf5 /synapse/handlers/user_directory.py | |
parent | pep8 (diff) | |
parent | Port register_new_matrix_user to Python 3 and add tests (#4085) (diff) | |
download | synapse-03e634dad4cd1014f609ece9574df7a24f1ec254.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/purge_state_groups
Diffstat (limited to 'synapse/handlers/user_directory.py')
-rw-r--r-- | synapse/handlers/user_directory.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/synapse/handlers/user_directory.py b/synapse/handlers/user_directory.py index d8413d6aa7..f11b430126 100644 --- a/synapse/handlers/user_directory.py +++ b/synapse/handlers/user_directory.py @@ -20,6 +20,7 @@ from six import iteritems from twisted.internet import defer from synapse.api.constants import EventTypes, JoinRules, Membership +from synapse.metrics.background_process_metrics import run_as_background_process from synapse.storage.roommember import ProfileInfo from synapse.types import get_localpart_from_id from synapse.util.metrics import Measure @@ -98,7 +99,6 @@ class UserDirectoryHandler(object): """ return self.store.search_user_dir(user_id, search_term, limit) - @defer.inlineCallbacks def notify_new_event(self): """Called when there may be more deltas to process """ @@ -108,11 +108,15 @@ class UserDirectoryHandler(object): if self._is_processing: return + @defer.inlineCallbacks + def process(): + try: + yield self._unsafe_process() + finally: + self._is_processing = False + self._is_processing = True - try: - yield self._unsafe_process() - finally: - self._is_processing = False + run_as_background_process("user_directory.notify_new_event", process) @defer.inlineCallbacks def handle_local_profile_change(self, user_id, profile): |