From ddd210b491fa57ac6b9ece9e89053d2639d32ad0 Mon Sep 17 00:00:00 2001 From: Sean Quah Date: Tue, 14 Feb 2023 03:42:01 +0000 Subject: [PATCH] Faster joins: Omit device list updates from partial state rooms in /sync ...when lazy loading of members is not enabled. It's weird to notify a client that another user's device list has changed when the client doesn't think that they share a room. Note that when a room is un-partial stated, device list updates are emitted for every member in that room over /sync. Signed-off-by: Sean Quah --- changelog.d/15069.misc | 1 + synapse/handlers/sync.py | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 changelog.d/15069.misc diff --git a/changelog.d/15069.misc b/changelog.d/15069.misc new file mode 100644 index 000000000000..e7a619ad2b5b --- /dev/null +++ b/changelog.d/15069.misc @@ -0,0 +1 @@ +Faster joins: omit device list updates originating from partial state rooms in /sync responses without lazy loading of members enabled. diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 4bae46158acf..1360a2aafb12 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -1391,6 +1391,11 @@ async def generate_sync_result( for room_id, is_partial_state in results.items() if is_partial_state ) + membership_change_events = [ + event + for event in membership_change_events + if not results.get(event.room_id, False) + ] # Incremental eager syncs should additionally include rooms that # - we are joined to