mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 18:54:51 -04:00
Optimise calculating device_list changes in /sync
. (#11974)
For users with large accounts it is inefficient to calculate the set of users they share a room with (and takes a lot of space in the cache). Instead we can look at users whose devices have changed since the last sync and check if they share a room with the syncing user.
This commit is contained in:
parent
bab2394aa9
commit
2b5643b3af
4 changed files with 125 additions and 14 deletions
|
@ -670,6 +670,16 @@ class DeviceWorkerStore(SQLBaseStore):
|
|||
device["device_id"]: db_to_json(device["content"]) for device in devices
|
||||
}
|
||||
|
||||
def get_cached_device_list_changes(
|
||||
self,
|
||||
from_key: int,
|
||||
) -> Optional[Set[str]]:
|
||||
"""Get set of users whose devices have changed since `from_key`, or None
|
||||
if that information is not in our cache.
|
||||
"""
|
||||
|
||||
return self._device_list_stream_cache.get_all_entities_changed(from_key)
|
||||
|
||||
async def get_users_whose_devices_changed(
|
||||
self, from_key: int, user_ids: Iterable[str]
|
||||
) -> Set[str]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue