summary refs log tree commit diff
path: root/synapse/notifier.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-05-08 16:32:18 +0100
committerErik Johnston <erik@matrix.org>2015-05-08 16:32:18 +0100
commit476899295f5fd6cff64799bcbc84cd4bf9005e33 (patch)
treecacce7f0de3c1b694cce8c805c21c297cfbdeb76 /synapse/notifier.py
parentMerge branch 'master' of github.com:matrix-org/synapse into develop (diff)
downloadsynapse-476899295f5fd6cff64799bcbc84cd4bf9005e33.tar.xz
Change the way we do logging contexts so that they survive divergences
Diffstat (limited to 'synapse/notifier.py')
-rw-r--r--synapse/notifier.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/synapse/notifier.py b/synapse/notifier.py
index 78eb28e4b2..fbbccb38e6 100644
--- a/synapse/notifier.py
+++ b/synapse/notifier.py
@@ -16,7 +16,7 @@
 from twisted.internet import defer
 
 from synapse.util.logutils import log_function
-from synapse.util.logcontext import PreserveLoggingContext
+from synapse.util.logcontext import preserve_context_over_deferred
 from synapse.types import StreamToken
 import synapse.metrics
 
@@ -223,11 +223,10 @@ class Notifier(object):
         def eb(failure):
             logger.exception("Failed to notify listener", failure)
 
-        with PreserveLoggingContext():
-            yield defer.DeferredList(
+        yield defer.DeferredList(
                 [notify(l).addErrback(eb) for l in listeners],
                 consumeErrors=True,
-            )
+        )
 
     @defer.inlineCallbacks
     @log_function
@@ -298,11 +297,10 @@ class Notifier(object):
                     failure.getTracebackObject())
             )
 
-        with PreserveLoggingContext():
-            yield defer.DeferredList(
-                [notify(l).addErrback(eb) for l in listeners],
-                consumeErrors=True,
-            )
+        yield defer.DeferredList(
+            [notify(l).addErrback(eb) for l in listeners],
+            consumeErrors=True,
+        )
 
     @defer.inlineCallbacks
     def wait_for_events(self, user, rooms, filter, timeout, callback):