summary refs log tree commit diff
path: root/synapse/storage/state.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-05-13 15:13:42 +0100
committerErik Johnston <erik@matrix.org>2015-05-13 15:13:42 +0100
commitca4f458787d4fcccf4d6b240f7497cac4e174bcc (patch)
tree4a27c4b7412ffb0e18a1b3981af8c3ffd38f5b7a /synapse/storage/state.py
parentDon't fetch redaction and rejection stuff for each event, so we can use index... (diff)
downloadsynapse-ca4f458787d4fcccf4d6b240f7497cac4e174bcc.tar.xz
Fetch events in bulk
Diffstat (limited to '')
-rw-r--r--synapse/storage/state.py22
1 files changed, 1 insertions, 21 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index 6d0ecf8dd9..a80a947436 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -83,31 +83,11 @@ class StateStore(SQLBaseStore):
             f,
         )
 
-        def fetch_events(txn, events):
-            sql = (
-                "SELECT e.internal_metadata, e.json, r.redacts, rej.event_id "
-                " FROM event_json as e"
-                " LEFT JOIN rejections as rej USING (event_id)"
-                " LEFT JOIN redactions as r ON e.event_id = r.redacts"
-                " WHERE e.event_id IN (%s)"
-            ) % (",".join(["?"]*len(events)),)
-
-            txn.execute(sql, events)
-            rows = txn.fetchall()
-
-            return [
-                self._get_event_from_row_txn(
-                    txn, row[0], row[1], row[2],
-                    rejected_reason=row[3],
-                )
-                for row in rows
-            ]
-
         @defer.inlineCallbacks
         def c(vals):
             vals[:] = yield self.runInteraction(
                 "_get_state_groups_ev",
-                fetch_events, vals
+                self._fetch_events_txn, vals
             )
 
         yield defer.gatherResults(