summary refs log tree commit diff
path: root/synapse/storage/state.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-03-24 11:07:02 +0000
committerErik Johnston <erik@matrix.org>2017-03-24 11:07:02 +0000
commitd58b1ffe9424453526026e294ac9b6458d31eb9d (patch)
tree5ebefdbf0bfa1d73a34b3b33024a72b61a33e7cf /synapse/storage/state.py
parentUse iter(items|values) (diff)
downloadsynapse-d58b1ffe9424453526026e294ac9b6458d31eb9d.tar.xz
Replace some calls to cursor_to_dict
cursor_to_dict can be surprisinglh expensive for large result sets, so lets
only call it when we need to.
Diffstat (limited to 'synapse/storage/state.py')
-rw-r--r--synapse/storage/state.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index aedd597ded..314216f039 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -342,10 +342,10 @@ class StateStore(SQLBaseStore):
                     args.extend(where_args)
 
                     txn.execute(sql % (where_clause,), args)
-                    rows = self.cursor_to_dict(txn)
-                    for row in rows:
-                        key = (row["type"], row["state_key"])
-                        results[group][key] = row["event_id"]
+                    for row in txn:
+                        typ, state_key, event_id = row
+                        key = (typ, state_key)
+                        results[group][key] = event_id
         else:
             if types is not None:
                 where_clause = "AND (%s)" % (