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

Use less DB for device list handling in sync #2362

Merged
merged 1 commit into from
Jul 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,18 +579,17 @@ def _generate_sync_entry_for_device_list(self, sync_result_builder):
since_token = sync_result_builder.since_token

if since_token and since_token.device_list_key:
room_ids = yield self.store.get_rooms_for_user(user_id)

user_ids_changed = set()
changed = yield self.store.get_user_whose_devices_changed(
since_token.device_list_key
)
for other_user_id in changed:
other_room_ids = yield self.store.get_rooms_for_user(other_user_id)
if room_ids.intersection(other_room_ids):
user_ids_changed.add(other_user_id)
if not changed:
defer.returnValue([])

users_who_share_room = yield self.store.get_users_who_share_room_with_user(
user_id
)

defer.returnValue(user_ids_changed)
defer.returnValue(users_who_share_room & changed)
else:
defer.returnValue([])

Expand Down