mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-19 16:32:24 +01:00
Merge pull request #2362 from matrix-org/erikj/sync_user_users_who_share
Use less DB for device list handling in sync
This commit is contained in:
commit
91818723a1
1 changed files with 7 additions and 8 deletions
|
@ -579,18 +579,17 @@ class SyncHandler(object):
|
||||||
since_token = sync_result_builder.since_token
|
since_token = sync_result_builder.since_token
|
||||||
|
|
||||||
if since_token and since_token.device_list_key:
|
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(
|
changed = yield self.store.get_user_whose_devices_changed(
|
||||||
since_token.device_list_key
|
since_token.device_list_key
|
||||||
)
|
)
|
||||||
for other_user_id in changed:
|
if not changed:
|
||||||
other_room_ids = yield self.store.get_rooms_for_user(other_user_id)
|
defer.returnValue([])
|
||||||
if room_ids.intersection(other_room_ids):
|
|
||||||
user_ids_changed.add(other_user_id)
|
|
||||||
|
|
||||||
defer.returnValue(user_ids_changed)
|
users_who_share_room = yield self.store.get_users_who_share_room_with_user(
|
||||||
|
user_id
|
||||||
|
)
|
||||||
|
|
||||||
|
defer.returnValue(users_who_share_room & changed)
|
||||||
else:
|
else:
|
||||||
defer.returnValue([])
|
defer.returnValue([])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue