diff options
author | Erik Johnston <erik@matrix.org> | 2017-03-01 10:21:30 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-03-01 10:21:30 +0000 |
commit | 3365117151217f0ea96291aabce222f8b58bd850 (patch) | |
tree | 16c5254f094a69f90af5b2aa524bca5bb8c95fe1 | |
parent | Don't log unknown cache warnings in workers (diff) | |
download | synapse-3365117151217f0ea96291aabce222f8b58bd850.tar.xz |
Clobber old device list stream entries
-rw-r--r-- | synapse/storage/devices.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/storage/devices.py b/synapse/storage/devices.py index 7b5903bf8e..f9ed18d2aa 100644 --- a/synapse/storage/devices.py +++ b/synapse/storage/devices.py @@ -546,6 +546,16 @@ class DeviceStore(SQLBaseStore): host, stream_id, ) + # Delete older entries in the table, as we really only care about + # when the latest change happened. + txn.executemany( + """ + DELETE FROM device_lists_stream + WHERE user_id = ? AND device_id = ? AND stream_id < ? + """, + [(user_id, device_id, stream_id) for device_id in device_ids] + ) + self._simple_insert_many_txn( txn, table="device_lists_stream", |