diff options
author | Travis Ralston <travpc@gmail.com> | 2018-10-31 13:15:14 -0600 |
---|---|---|
committer | Travis Ralston <travpc@gmail.com> | 2018-10-31 13:15:14 -0600 |
commit | d1e7b9c44c127c8e9ddbbf4c45604a5482448b2e (patch) | |
tree | c832189c0f04fa02354feb419d72d6ad64b0e77f /synapse/storage/devices.py | |
parent | pep8 (diff) | |
parent | Merge pull request #4101 from matrix-org/rav/aliases_for_upgrades (diff) | |
download | synapse-d1e7b9c44c127c8e9ddbbf4c45604a5482448b2e.tar.xz |
Merge branch 'develop' into travis/login-terms
Diffstat (limited to 'synapse/storage/devices.py')
-rw-r--r-- | synapse/storage/devices.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/storage/devices.py b/synapse/storage/devices.py index d10ff9e4b9..62497ab63f 100644 --- a/synapse/storage/devices.py +++ b/synapse/storage/devices.py @@ -589,10 +589,14 @@ class DeviceStore(SQLBaseStore): combined list of changes to devices, and which destinations need to be poked. `destination` may be None if no destinations need to be poked. """ + # We do a group by here as there can be a large number of duplicate + # entries, since we throw away device IDs. sql = """ - SELECT stream_id, user_id, destination FROM device_lists_stream + SELECT MAX(stream_id) AS stream_id, user_id, destination + FROM device_lists_stream LEFT JOIN device_lists_outbound_pokes USING (stream_id, user_id, device_id) WHERE ? < stream_id AND stream_id <= ? + GROUP BY user_id, destination """ return self._execute( "get_all_device_list_changes_for_remotes", None, |