summary refs log tree commit diff
path: root/synapse/notifier.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2019-03-04 18:31:18 +0000
committerRichard van der Hoff <richard@matrix.org>2019-03-04 18:31:18 +0000
commitc7325776a7a02354657c519eb5169c1f2f3e0872 (patch)
tree90c5d24a5ab7bf71a8acc2e23a36bd7e80d6de7a /synapse/notifier.py
parentRemove unused `wait_for_replication` method (diff)
downloadsynapse-c7325776a7a02354657c519eb5169c1f2f3e0872.tar.xz
Remove redundant PreserveLoggingContext
Both (!) things that register as replication listeners do the right thing wrt
logcontexts, so this is redundant.
Diffstat (limited to '')
-rw-r--r--synapse/notifier.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/synapse/notifier.py b/synapse/notifier.py
index 2505202e98..ff589660da 100644
--- a/synapse/notifier.py
+++ b/synapse/notifier.py
@@ -203,7 +203,9 @@ class Notifier(object):
 
     def add_replication_callback(self, cb):
         """Add a callback that will be called when some new data is available.
-        Callback is not given any arguments.
+        Callback is not given any arguments. It should *not* return a Deferred - if
+        it needs to do any asynchronous work, a background thread should be started and
+        wrapped with run_as_background_process.
         """
         self.replication_callbacks.append(cb)
 
@@ -515,12 +517,5 @@ class Notifier(object):
 
     def notify_replication(self):
         """Notify the any replication listeners that there's a new event"""
-        with PreserveLoggingContext():
-            # 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()
+        for cb in self.replication_callbacks:
+            cb()