Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Replace calls to get_rooms_for_users_with_stream_ordering
Browse files Browse the repository at this point in the history
None of the calls to this function ever use the stream ordering component
returned, so can just use the simplified `get_rooms_for_users`.
  • Loading branch information
Fizzadar committed Sep 13, 2022
1 parent 1008106 commit c98bbfc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions synapse/handlers/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ async def get_user_ids_changed(
possibly_left = possibly_changed | possibly_left

# Double check if we still share rooms with the given user.
users_rooms = await self.store.get_rooms_for_users_with_stream_ordering(
users_rooms = await self.store.get_rooms_for_users(
possibly_left
)
for changed_user_id, entries in users_rooms.items():
if any(e.room_id in room_ids for e in entries):
if any(room_id in room_ids for room_id in entries):
possibly_left.discard(changed_user_id)
else:
possibly_joined.discard(changed_user_id)
Expand Down
8 changes: 4 additions & 4 deletions synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ async def _generate_sync_entry_for_device_list(
since_token.device_list_key
)
if changed_users is not None:
result = await self.store.get_rooms_for_users_with_stream_ordering(
result = await self.store.get_rooms_for_users(
changed_users
)

Expand All @@ -1483,7 +1483,7 @@ async def _generate_sync_entry_for_device_list(
# 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:
Expand Down Expand Up @@ -1518,12 +1518,12 @@ async def _generate_sync_entry_for_device_list(

# Remove any users that we still share a room with.
left_users_rooms = (
await self.store.get_rooms_for_users_with_stream_ordering(
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(
Expand Down

0 comments on commit c98bbfc

Please sign in to comment.