diff options
author | Nick Mills-Barrett <nick@beeper.com> | 2022-09-29 14:55:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-29 13:55:12 +0000 |
commit | a466164647b969efd2e85168144cd75693443c05 (patch) | |
tree | f69547590e89cecc7788fb06d770d15a5bba37a3 /synapse/handlers/sync.py | |
parent | Allow admins to require a manual approval process before new accounts can be ... (diff) | |
download | synapse-a466164647b969efd2e85168144cd75693443c05.tar.xz |
Optimise get_rooms_for_user (drop with_stream_ordering) (#13787)
Diffstat (limited to 'synapse/handlers/sync.py')
-rw-r--r-- | synapse/handlers/sync.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index e75fc6b947..4abb9b6127 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -1490,16 +1490,14 @@ class SyncHandler: since_token.device_list_key ) if changed_users is not None: - result = await self.store.get_rooms_for_users_with_stream_ordering( - changed_users - ) + result = await self.store.get_rooms_for_users(changed_users) for changed_user_id, entries in result.items(): # Check if the changed user shares any rooms with the user, # or if the changed user is the syncing user (as we always # want to include device list updates of their own devices). if user_id == changed_user_id or any( - e.room_id in joined_rooms for e in entries + rid in joined_rooms for rid in entries ): users_that_have_changed.add(changed_user_id) else: @@ -1533,13 +1531,9 @@ class SyncHandler: newly_left_users.update(left_users) # Remove any users that we still share a room with. - left_users_rooms = ( - await self.store.get_rooms_for_users_with_stream_ordering( - newly_left_users - ) - ) + left_users_rooms = await self.store.get_rooms_for_users(newly_left_users) for user_id, entries in left_users_rooms.items(): - if any(e.room_id in joined_rooms for e in entries): + if any(rid in joined_rooms for rid in entries): newly_left_users.discard(user_id) return DeviceListUpdates( |