diff options
author | Erik Johnston <erik@matrix.org> | 2017-03-23 17:53:49 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-03-23 17:53:49 +0000 |
commit | 00957d1aa4b01a199ab2c3abf30032a0ca0b1e12 (patch) | |
tree | 79f6e968f784c6d4e05cda9c298d5a32fbc88291 /synapse/storage/account_data.py | |
parent | Merge pull request #2005 from kfatehi/docs/readme (diff) | |
download | synapse-00957d1aa4b01a199ab2c3abf30032a0ca0b1e12.tar.xz |
User Cursor.__iter__ instead of fetchall
This prevents unnecessary construction of lists
Diffstat (limited to 'synapse/storage/account_data.py')
-rw-r--r-- | synapse/storage/account_data.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/storage/account_data.py b/synapse/storage/account_data.py index 3fa226e92d..aa84ffc2b0 100644 --- a/synapse/storage/account_data.py +++ b/synapse/storage/account_data.py @@ -182,7 +182,7 @@ class AccountDataStore(SQLBaseStore): txn.execute(sql, (user_id, stream_id)) global_account_data = { - row[0]: json.loads(row[1]) for row in txn.fetchall() + row[0]: json.loads(row[1]) for row in txn } sql = ( @@ -193,7 +193,7 @@ class AccountDataStore(SQLBaseStore): txn.execute(sql, (user_id, stream_id)) account_data_by_room = {} - for row in txn.fetchall(): + for row in txn: room_account_data = account_data_by_room.setdefault(row[0], {}) room_account_data[row[1]] = json.loads(row[2]) |