summary refs log tree commit diff
path: root/synapse/storage/stream.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-02-08 15:16:16 +0000
committerErik Johnston <erik@matrix.org>2016-02-08 15:16:16 +0000
commit2bb5f035affda14742ab715033570616621c0000 (patch)
tree9348a7051ebb1d264afa47b2ce2d87c8b19f5523 /synapse/storage/stream.py
parentMerge pull request #562 from matrix-org/erikj/push_metric (diff)
parentFix up logcontexts (diff)
downloadsynapse-2bb5f035affda14742ab715033570616621c0000.tar.xz
Merge pull request #564 from matrix-org/erikj/logcontext
Fix up logcontexts
Diffstat (limited to 'synapse/storage/stream.py')
-rw-r--r--synapse/storage/stream.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/synapse/storage/stream.py b/synapse/storage/stream.py
index 50436cb2d2..367ffc9543 100644
--- a/synapse/storage/stream.py
+++ b/synapse/storage/stream.py
@@ -39,6 +39,7 @@ from ._base import SQLBaseStore
 from synapse.util.caches.descriptors import cachedInlineCallbacks
 from synapse.api.constants import EventTypes
 from synapse.types import RoomStreamToken
+from synapse.util.logcontext import preserve_fn
 
 import logging
 
@@ -170,12 +171,12 @@ class StreamStore(SQLBaseStore):
         room_ids = list(room_ids)
         for rm_ids in (room_ids[i:i + 20] for i in xrange(0, len(room_ids), 20)):
             res = yield defer.gatherResults([
-                self.get_room_events_stream_for_room(
-                    room_id, from_key, to_key, limit
-                ).addCallback(lambda r, rm: (rm, r), room_id)
+                preserve_fn(self.get_room_events_stream_for_room)(
+                    room_id, from_key, to_key, limit,
+                )
                 for room_id in room_ids
             ])
-            results.update(dict(res))
+            results.update(dict(zip(rm_ids, res)))
 
         defer.returnValue(results)