summary refs log tree commit diff
path: root/synapse/storage/databases/main/devices.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2024-01-12 12:20:17 +0000
committerErik Johnston <erik@matrix.org>2024-01-12 12:20:17 +0000
commit4df836af09cb0424757852b286a38b24543a3286 (patch)
tree8ccbcb4b2c0b0c43dfb838e2ffea3d0cddf502ea /synapse/storage/databases/main/devices.py
parentMerge remote-tracking branch 'origin/develop' into matrix-org-hotfixes (diff)
parentUpdate license in Debian metadata (#16807) (diff)
downloadsynapse-matrix-org-hotfixes.tar.xz
Merge remote-tracking branch 'origin/develop' into matrix-org-hotfixes matrix-org-hotfixes
Diffstat (limited to 'synapse/storage/databases/main/devices.py')
-rw-r--r--synapse/storage/databases/main/devices.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/storage/databases/main/devices.py b/synapse/storage/databases/main/devices.py

index 38029710db..d3859014b6 100644 --- a/synapse/storage/databases/main/devices.py +++ b/synapse/storage/databases/main/devices.py
@@ -1796,7 +1796,7 @@ class DeviceStore(DeviceWorkerStore, DeviceBackgroundUpdateStore): device_ids: The IDs of the devices to delete """ - def _delete_devices_txn(txn: LoggingTransaction) -> None: + def _delete_devices_txn(txn: LoggingTransaction, device_ids: List[str]) -> None: self.db_pool.simple_delete_many_txn( txn, table="devices", @@ -1813,7 +1813,11 @@ class DeviceStore(DeviceWorkerStore, DeviceBackgroundUpdateStore): keyvalues={"user_id": user_id}, ) - await self.db_pool.runInteraction("delete_devices", _delete_devices_txn) + for batch in batch_iter(device_ids, 100): + await self.db_pool.runInteraction( + "delete_devices", _delete_devices_txn, batch + ) + for device_id in device_ids: self.device_id_exists_cache.invalidate((user_id, device_id))