diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2022-02-03 14:25:18 +0000 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2022-02-03 14:32:41 +0000 |
commit | 22a9ad2780f58b4c33e54455ed9b11921769b33a (patch) | |
tree | 086627ae68209b392c075c906c6696c59fd29293 | |
parent | Add a ratelimiter for 3pid invite (#11892) (diff) | |
download | synapse-22a9ad2780f58b4c33e54455ed9b11921769b33a.tar.xz |
Re-use calculated list of users instead of re-calculating in on_new_event
-rw-r--r-- | synapse/handlers/device.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/synapse/handlers/device.py b/synapse/handlers/device.py index b184a48cb1..22032ada53 100644 --- a/synapse/handlers/device.py +++ b/synapse/handlers/device.py @@ -495,13 +495,11 @@ class DeviceHandler(DeviceWorkerHandler): "Notifying about update %r/%r, ID: %r", user_id, device_id, position ) - room_ids = await self.store.get_rooms_for_user(user_id) - # specify the user ID too since the user should always get their own device list # updates, even if they aren't in any rooms. - self.notifier.on_new_event( - "device_list_key", position, users=[user_id], rooms=room_ids - ) + users_to_notify = users_who_share_room.union(user_id) + + self.notifier.on_new_event("device_list_key", position, users=users_to_notify) if hosts: logger.info( |