From f045574426f3e93ae132ce2238a48d3deedd5cb9 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Mon, 9 Sep 2024 23:25:08 -0500 Subject: [PATCH] Better comments --- synapse/storage/databases/main/events_bg_updates.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/synapse/storage/databases/main/events_bg_updates.py b/synapse/storage/databases/main/events_bg_updates.py index 6a05014756..cd64d702ad 100644 --- a/synapse/storage/databases/main/events_bg_updates.py +++ b/synapse/storage/databases/main/events_bg_updates.py @@ -2134,7 +2134,7 @@ class EventsBackgroundUpdatesStore(StreamWorkerStore, StateDeltasStore, SQLBaseS Tuple[str, str], SlidingSyncMembershipInfoWithEventPos ] = {} - # Map from room_id to ... + # Map from room_id to the last join membership snapshot/info we inserted. # Just some convenience maps for easier lookup by `room_id`. last_to_insert_join_membership_snapshots_by_room_id: Dict[ str, SlidingSyncMembershipSnapshotSharedInsertValues @@ -2148,8 +2148,8 @@ class EventsBackgroundUpdatesStore(StreamWorkerStore, StateDeltasStore, SQLBaseS Tuple[str, Optional[str], str, str, str, str, int, Optional[str], bool] ], ) -> None: - if not memberships_to_update_rows: - return + # We should have exited earlier if there were no rows to process + assert len(memberships_to_update_rows) > 0 room_id_for_all_rows: str = memberships_to_update_rows[0][0] @@ -2164,9 +2164,9 @@ class EventsBackgroundUpdatesStore(StreamWorkerStore, StateDeltasStore, SQLBaseS membership_event_instance_name, is_outlier, ) in memberships_to_update_rows: - # Sanity check that we're working on the same room so the snapshot - # re-use logic can work properly (we need to process memberships in a - # room sequentially chronologically) + # Sanity check that we're working on the same room for all of the rows + # so the snapshot re-use logic can work properly (we need to process + # memberships in a room sequentially chronologically) assert room_id == room_id_for_all_rows # We don't know how to handle `membership` values other than these. The