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

Commit

Permalink
User 'device_lists_changes_in_room' for /sync
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed Jun 14, 2022
1 parent ace6b93 commit ae7c92a
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ def __init__(self, hs: "HomeServer"):
self.auth_blocking = hs.get_auth_blocking()
self._storage_controllers = hs.get_storage_controllers()
self._state_storage_controller = self._storage_controllers.state
self._device_handler = hs.get_device_handler()

# TODO: flush cache entries on subsequent sync request.
# Once we get the next /sync request (ie, one with the same access token
Expand Down Expand Up @@ -1272,21 +1273,11 @@ async def _generate_sync_entry_for_device_list(
):
users_that_have_changed.add(changed_user_id)
else:
users_who_share_room = (
await self.store.get_users_who_share_room_with_user(user_id)
)

# 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)

tracked_users = users_who_share_room
users_that_have_changed = (
await self.store.get_users_whose_devices_changed(
since_token.device_list_key, tracked_users
await self._device_handler.get_device_changes_in_shared_rooms(
user_id,
sync_result_builder.joined_room_ids,
from_token=since_token,
)
)

Expand Down

0 comments on commit ae7c92a

Please sign in to comment.