diff options
author | Erik Johnston <erikj@jki.re> | 2017-07-12 10:45:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-12 10:45:30 +0100 |
commit | 91818723a112078ecef37b0bae658131c7a15abe (patch) | |
tree | c080b4d97902b6e05acb140231f0696afd57adbe /synapse/handlers | |
parent | Merge pull request #2354 from krombel/reduce_static_sync_reply (diff) | |
parent | Use less DB for device list handling in sync (diff) | |
download | synapse-91818723a112078ecef37b0bae658131c7a15abe.tar.xz |
Merge pull request #2362 from matrix-org/erikj/sync_user_users_who_share
Use less DB for device list handling in sync
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/sync.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 91c6c6be3c..e6df1819b9 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -579,18 +579,17 @@ class SyncHandler(object): 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([]) |