diff options
author | Olivier Wilkinson (reivilibre) <oliverw@matrix.org> | 2022-12-19 17:50:57 +0000 |
---|---|---|
committer | Olivier Wilkinson (reivilibre) <oliverw@matrix.org> | 2022-12-19 20:20:14 +0000 |
commit | 68ecfc346baabdff94524204cbfd2424c1840d4d (patch) | |
tree | 7a164b4594e46e654c5cdfd6b8cbb9a3a7ee684c | |
parent | Tidy up CHANGES.md (diff) | |
download | synapse-68ecfc346baabdff94524204cbfd2424c1840d4d.tar.xz |
Build a set of who we are interested in first and foremost
-rw-r--r-- | synapse/handlers/e2e_keys.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/synapse/handlers/e2e_keys.py b/synapse/handlers/e2e_keys.py index 5fe102e2f2..94de0c0377 100644 --- a/synapse/handlers/e2e_keys.py +++ b/synapse/handlers/e2e_keys.py @@ -300,17 +300,17 @@ class E2eKeysHandler: # queries. We use the more efficient batched query_client_keys for all # remaining users user_ids_updated = [] - for (user_id, device_list) in destination_query.items(): - if user_id in user_ids_updated: - continue - - if device_list: - continue - room_ids = await self.store.get_rooms_for_user(user_id) - if not room_ids: - continue + # Perform a user device resync for each user only once and only as long as: + # - they have an empty device_list + # - they are in some rooms that this server can see + users_to_resync_devices = { + user_id + for (user_id, device_list) in destination_query.items() + if (not device_list) and (await self.store.get_rooms_for_user(user_id)) + } + for user_id in users_to_resync_devices: # We've decided we're sharing a room with this user and should # probably be tracking their device lists. However, we haven't # done an initial sync on the device list so we do it now. |