summary refs log tree commit diff
path: root/synapse/storage/devices.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-03-31 10:11:07 +0100
committerErik Johnston <erik@matrix.org>2017-03-31 10:11:07 +0100
commitd7dbc56c716e805c61f768e35acba590ec86667b (patch)
treedaeebe671813605cd33e13b72374f611c0a2b549 /synapse/storage/devices.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes (diff)
parentMerge pull request #2075 from matrix-org/erikj/cache_speed (diff)
downloadsynapse-d7dbc56c716e805c61f768e35acba590ec86667b.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes
Diffstat (limited to 'synapse/storage/devices.py')
-rw-r--r--synapse/storage/devices.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/storage/devices.py b/synapse/storage/devices.py

index 6beeff8b00..53e36791d5 100644 --- a/synapse/storage/devices.py +++ b/synapse/storage/devices.py
@@ -329,6 +329,7 @@ class DeviceStore(SQLBaseStore): SELECT user_id, device_id, max(stream_id) FROM device_lists_outbound_pokes WHERE destination = ? AND ? < stream_id AND stream_id <= ? AND sent = ? GROUP BY user_id, device_id + LIMIT 20 """ txn.execute( sql, (destination, from_stream_id, now_stream_id, False) @@ -339,6 +340,9 @@ class DeviceStore(SQLBaseStore): if not query_map: return (now_stream_id, []) + if len(query_map) >= 20: + now_stream_id = max(stream_id for stream_id in query_map.itervalues()) + devices = self._get_e2e_device_keys_txn( txn, query_map.keys(), include_all_devices=True )