summary refs log tree commit diff
path: root/synapse/storage/_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/storage/_base.py')
-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(