diff options
author | Eric Eastwood <eric.eastwood@beta.gouv.fr> | 2024-08-07 13:08:42 -0500 |
---|---|---|
committer | Eric Eastwood <eric.eastwood@beta.gouv.fr> | 2024-08-07 13:08:42 -0500 |
commit | eb40440512d0f400f6e42947d6ffc076658d3303 (patch) | |
tree | e289b0954d74f31c46a0492339d76340e95e13ec | |
parent | Better check whether we need to exclude partially stated rooms (diff) | |
download | synapse-eb40440512d0f400f6e42947d6ffc076658d3303.tar.xz |
Update comments
-rw-r--r-- | synapse/handlers/sliding_sync.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py index dbbe705dce..e22e56651a 100644 --- a/synapse/handlers/sliding_sync.py +++ b/synapse/handlers/sliding_sync.py @@ -377,23 +377,26 @@ class RoomSyncConfig: Also see `StateFilter.must_await_full_state(...)` for comparison + Partially-stated rooms should have all state events except for remote membership + events so if we require a remote membership event anywhere, then we need to + return `False`. + Args: is_mine_id: a callable which confirms if a given state_key matches a mxid of a local user is_mine_server_name: a callable which confirms if a given server name matches the local server name """ - # Partially-stated rooms should have all state events except for remote - # membership events so if we require a remote membership event anywhere, then we - # need to return `False`. - wildcard_state_keys = self.required_state_map.get(StateValues.WILDCARD) + # Requesting *all* state in the room so we have to wait if ( wildcard_state_keys is not None and StateValues.WILDCARD in wildcard_state_keys ): return True + # If the wildcards don't refer to remote user IDs, then we don't need to wait + # for full state. if wildcard_state_keys is not None: for possible_user_id in wildcard_state_keys: if not possible_user_id[0].startswith(UserID.SIGIL): @@ -409,11 +412,12 @@ class RoomSyncConfig: return True membership_state_keys = self.required_state_map.get(EventTypes.Member) - # We aren't requesting any membership events at all + # We aren't requesting any membership events at all so the partial state will + # cover us. if membership_state_keys is None: return False - # If we're requesting entirely local users, TODO + # If we're requesting entirely local users, the partial state will cover us. for user_id in membership_state_keys: if user_id == StateValues.ME: continue @@ -428,7 +432,7 @@ class RoomSyncConfig: elif not is_mine_id(user_id): return True - # local users only + # Local users only so the partial state will cover us. return False |