summary refs log tree commit diff
path: root/synapse/util/async.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-08-25 18:34:46 +0100
committerMark Haines <mark.haines@matrix.org>2016-08-25 18:34:46 +0100
commitab34fdecb777b057a0ec307328f309bb2bdee05c (patch)
tree541dc61435b893897e7a46d8f0a69443e18233d7 /synapse/util/async.py
parentAdd some TODOs (diff)
parentMerge pull request #1041 from matrix-org/paul/third-party-lookup (diff)
downloadsynapse-ab34fdecb777b057a0ec307328f309bb2bdee05c.tar.xz
Merge branch 'develop' into markjh/direct_to_device
Diffstat (limited to 'synapse/util/async.py')
-rw-r--r--synapse/util/async.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/synapse/util/async.py b/synapse/util/async.py
index c84b23ff46..347fb1e380 100644
--- a/synapse/util/async.py
+++ b/synapse/util/async.py
@@ -146,10 +146,10 @@ def concurrently_execute(func, args, limit):
         except StopIteration:
             pass
 
-    return defer.gatherResults([
+    return preserve_context_over_deferred(defer.gatherResults([
         preserve_fn(_concurrently_execute_inner)()
         for _ in xrange(limit)
-    ], consumeErrors=True).addErrback(unwrapFirstError)
+    ], consumeErrors=True)).addErrback(unwrapFirstError)
 
 
 class Linearizer(object):
@@ -181,7 +181,8 @@ class Linearizer(object):
         self.key_to_defer[key] = new_defer
 
         if current_defer:
-            yield preserve_context_over_deferred(current_defer)
+            with PreserveLoggingContext():
+                yield current_defer
 
         @contextmanager
         def _ctx_manager():
@@ -264,7 +265,7 @@ class ReadWriteLock(object):
         curr_readers.clear()
         self.key_to_current_writer[key] = new_defer
 
-        yield defer.gatherResults(to_wait_on)
+        yield preserve_context_over_deferred(defer.gatherResults(to_wait_on))
 
         @contextmanager
         def _ctx_manager():