summary refs log tree commit diff
path: root/synapse/notifier.py
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2017-11-30 01:51:38 +0000
committerMatthew Hodgson <matthew@matrix.org>2017-11-30 01:51:38 +0000
commitf397153dfc4020744e1cf8687abb01d4b7885a7a (patch)
tree342da238d1e7de6178731ad6a040bf9c3de16ce1 /synapse/notifier.py
parentspecify default user_directory_include_pattern (diff)
parentMerge pull request #2721 from matrix-org/rav/get_user_by_access_token_comments (diff)
downloadsynapse-f397153dfc4020744e1cf8687abb01d4b7885a7a.tar.xz
Merge branch 'develop' into matthew/search-all-local-users
Diffstat (limited to 'synapse/notifier.py')
-rw-r--r--synapse/notifier.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/synapse/notifier.py b/synapse/notifier.py
index 626da778cd..ef042681bc 100644
--- a/synapse/notifier.py
+++ b/synapse/notifier.py
@@ -255,9 +255,7 @@ class Notifier(object):
         )
 
         if self.federation_sender:
-            preserve_fn(self.federation_sender.notify_new_events)(
-                room_stream_id
-            )
+            self.federation_sender.notify_new_events(room_stream_id)
 
         if event.type == EventTypes.Member and event.membership == Membership.JOIN:
             self._user_joined_room(event.state_key, event.room_id)
@@ -297,8 +295,7 @@ class Notifier(object):
     def on_new_replication_data(self):
         """Used to inform replication listeners that something has happend
         without waking up any of the normal user event streams"""
-        with PreserveLoggingContext():
-            self.notify_replication()
+        self.notify_replication()
 
     @defer.inlineCallbacks
     def wait_for_events(self, user_id, timeout, callback, room_ids=None,
@@ -516,8 +513,14 @@ class Notifier(object):
             self.replication_deferred = ObservableDeferred(defer.Deferred())
             deferred.callback(None)
 
-        for cb in self.replication_callbacks:
-            preserve_fn(cb)()
+            # the callbacks may well outlast the current request, so we run
+            # them in the sentinel logcontext.
+            #
+            # (ideally it would be up to the callbacks to know if they were
+            # starting off background processes and drop the logcontext
+            # accordingly, but that requires more changes)
+            for cb in self.replication_callbacks:
+                cb()
 
     @defer.inlineCallbacks
     def wait_for_replication(self, callback, timeout):