summary refs log tree commit diff
diff options
context:
space:
mode:
authorMathieu Velten <mathieuv@matrix.org>2023-01-17 15:49:29 +0100
committerGitHub <noreply@github.com>2023-01-17 15:49:29 +0100
commitb01ec646006d11fc27f39ad8c30dca7410ca2bca (patch)
treeee897b0b5246a6a76fad3d123541d03f781a0f69
parentAddress comments (diff)
downloadsynapse-b01ec646006d11fc27f39ad8c30dca7410ca2bca.tar.xz
Apply suggestions from code review
Co-authored-by: David Robertson <davidr@element.io>
-rw-r--r--changelog.d/14831.misc2
-rw-r--r--synapse/handlers/sync.py13
-rw-r--r--synapse/storage/databases/main/room.py2
3 files changed, 9 insertions, 8 deletions
diff --git a/changelog.d/14831.misc b/changelog.d/14831.misc
index 72d6463f25..55aa666b1c 100644
--- a/changelog.d/14831.misc
+++ b/changelog.d/14831.misc
@@ -1 +1 @@
-Non lazy loading sync not blocking during fast join.
+Faster joins: non lazy-loading syncs will return immediately after a faster join, by omitting partial state rooms until we acquire their full satte.
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index 921d9d3e6e..b4c594ee0a 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -1926,9 +1926,9 @@ class SyncHandler:
 
         stream_id = since_token.room_key.stream
         for room_id in sync_result_builder.joined_room_ids:
-            # If a room has been un partial stated in the meantime,
-            # let's consider it has changes and deal with it accordingly
-            # in _get_rooms_changed.
+            # If a room has been un partial stated during the sync period,
+            # assume it has seen some kind of change. We'll process that
+            # change later, in _get_rooms_changed.
             if room_id in un_partial_stated_rooms:
                 return True
             if self.store.has_room_changed_since(room_id, stream_id):
@@ -2144,9 +2144,10 @@ class SyncHandler:
 
             newly_joined = room_id in newly_joined_rooms
 
-            # In case of a non lazy-loading-members sync we want to include
-            # rooms that got un partial stated in the meantime, and we need
-            # to include the full state of them.
+            # Partially joined rooms are omitted from non lazy-loading-members
+            # syncs until the resync completes and that room is fully stated. 
+            # When that happens, we need to include their full state in 
+            # the next non-lazy-loading sync.
             if (
                 not sync_config.filter_collection.lazy_load_members()
                 and room_id in un_partial_stated_rooms
diff --git a/synapse/storage/databases/main/room.py b/synapse/storage/databases/main/room.py
index c614eda076..2b200099bb 100644
--- a/synapse/storage/databases/main/room.py
+++ b/synapse/storage/databases/main/room.py
@@ -1293,7 +1293,7 @@ class RoomWorkerStore(CacheInvalidationWorkerStore):
         `current_id` inclusive.
 
         Returns:
-            The list of rooms.
+            The list of room ids.
         """
 
         if last_id == current_id: