summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-05-14 13:58:49 +0100
committerErik Johnston <erik@matrix.org>2015-05-14 13:58:49 +0100
commite1e9f0c5b23e1404ba885b501b6a347346a119ea (patch)
tree4c0bf58d78250610c573440195c163323ea4aec9 /synapse
parentErr, we probably want a bigger limit (diff)
downloadsynapse-e1e9f0c5b23e1404ba885b501b6a347346a119ea.tar.xz
loop -> gatherResults
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/_base.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index 5c33bd81a8..015e04a8ce 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -973,16 +973,20 @@ class SQLBaseStore(object):
                 res = yield self._execute("_fetch_events", None, sql, *evs)
                 rows.extend(res)
 
-        res = []
-        for row in rows:
-            e = yield self._get_event_from_row(
-                txn,
-                row[0], row[1], row[2],
-                check_redacted=check_redacted,
-                get_prev_content=get_prev_content,
-                rejected_reason=row[3],
-            )
-            res.append(e)
+        res = yield defer.gatherResults(
+            [
+                defer.maybeDeferred(
+                    self._get_event_from_row,
+                    txn,
+                    row[0], row[1], row[2],
+                    check_redacted=check_redacted,
+                    get_prev_content=get_prev_content,
+                    rejected_reason=row[3],
+                )
+                for row in rows
+            ],
+            consumeErrors=True,
+        )
 
         for e in res:
             self._get_event_cache.prefill(