mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 18:34:56 -04:00
Limit the number of devices we delete at once (#14649)
This commit is contained in:
parent
c2de2ca630
commit
94bc21e69f
4 changed files with 43 additions and 4 deletions
|
@ -458,10 +458,12 @@ class DeviceHandler(DeviceWorkerHandler):
|
|||
|
||||
async def _prune_too_many_devices(self, user_id: str) -> None:
|
||||
"""Delete any excess old devices this user may have."""
|
||||
device_ids = await self.store.check_too_many_devices_for_user(user_id)
|
||||
device_ids = await self.store.check_too_many_devices_for_user(user_id, 100)
|
||||
if not device_ids:
|
||||
return
|
||||
|
||||
logger.info("Pruning %d old devices for user %s", len(device_ids), user_id)
|
||||
|
||||
# We don't want to block and try and delete tonnes of devices at once,
|
||||
# so we cap the number of devices we delete synchronously.
|
||||
first_batch, remaining_device_ids = device_ids[:10], device_ids[10:]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue