element-hq / element-hq/synapse
Deleting stale devices causes lots of device updates to be sent out over federation
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#14651](https://github.com/matrix-org/synapse/issues/14651).
---
https://github.com/matrix-org/synapse/pull/14595 introduced ~~a background job~~ code that runs in `DeviceWorkerHandler.check_device_registered` to remove old, non-e2ee devices for users that had >50 devices, in an attempt to reduce the number of devices on homeservers.
When this was applied to matrix.org, it ended up spamming homeservers over federation with device list updates.
We may want to consider a rate-limit for the amount of devices we remove in this - and future - cleanup jobs.
Contributor guide
Research direction
Start in DeviceWorkerHandler.check_device_registered and inspect PR 14595 to understand how stale non-E2EE devices are removed and how federation updates are triggered. Define and implement a removal rate limit that prevents cleanup from spamming homeservers, then verify that cleanup still occurs without excessive device-list updates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100