summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-05-13 11:29:03 +0100
committerErik Johnston <erik@matrix.org>2015-05-13 11:29:03 +0100
commit619a21812be7872832865372587e98ed9e690184 (patch)
treef5c44bdea75e8a3d9907c3b511e6f6a7a0f233b7 /synapse
parentBatch fetching of events for state groups (diff)
downloadsynapse-619a21812be7872832865372587e98ed9e690184.tar.xz
defer.gatherResults loop
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/state.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index c300c6e29c..2b5c2d999d 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -103,12 +103,18 @@ class StateStore(SQLBaseStore):
                 for row in rows
             ]
 
-        for vals in states.values():
+        @defer.inlineCallbacks
+        def c(vals):
             vals[:] = yield self.runInteraction(
                 "_get_state_groups_ev",
                 fetch_events, vals
             )
 
+        yield defer.gatherResults(
+            [c(vals) for vals in states.values()],
+            consumeErrors=True,
+        )
+
         defer.returnValue(states)
 
     def _store_state_groups_txn(self, txn, event, context):