mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-21 14:34:10 -04:00
Speed up fetching device lists changes in sync.
Currently we copy `users_who_share_room` needlessly about three times, which is expensive when the set is large (which it can easily be).
This commit is contained in:
parent
b2dba06079
commit
f9073893af
3 changed files with 24 additions and 9 deletions
|
@ -1143,10 +1143,14 @@ class SyncHandler(object):
|
|||
user_id
|
||||
)
|
||||
|
||||
tracked_users = set(users_who_share_room)
|
||||
# Always tell the user about their own devices. We check as the user
|
||||
# ID is almost certainly already included (unless they're not in any
|
||||
# rooms) and taking a copy of the set is relatively expensive.
|
||||
if user_id not in users_who_share_room:
|
||||
users_who_share_room = set(users_who_share_room)
|
||||
users_who_share_room.add(user_id)
|
||||
|
||||
# Always tell the user about their own devices
|
||||
tracked_users.add(user_id)
|
||||
tracked_users = users_who_share_room
|
||||
|
||||
# Step 1a, check for changes in devices of users we share a room with
|
||||
users_that_have_changed = await self.store.get_users_whose_devices_changed(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue