summary refs log tree commit diff
path: root/synapse/storage/databases/main/sliding_sync.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@element.io>2024-10-14 13:31:22 +0100
committerGitHub <noreply@github.com>2024-10-14 13:31:22 +0100
commitd025b5ab508020740501ac8cca0da2fd99e89cee (patch)
tree04c813c0f4c0321d88484a449de3796ca2cc1897 /synapse/storage/databases/main/sliding_sync.py
parentBump mypy-zope from 1.0.5 to 1.0.7 (#17827) (diff)
downloadsynapse-d025b5ab508020740501ac8cca0da2fd99e89cee.tar.xz
Correctly changes to required state config in sliding sync (#17785)
Fixes https://github.com/element-hq/synapse/issues/17698

This handles `required_state` changes by checking if new state has been
added to the config, and if so fetching and returning that from the
current state.

This also takes care to ensure that given a state entry S that is added,
removed and then re-added that we do *not* send S down a second time if
there have been no changes to S in the current state. This is fine for
Rust SDK (as it just remembers all state), but we might decide not to do
this behaviour in the MSC. If we decide to always send down S then its
easy enough to rip out all the code.

---------

Co-authored-by: Eric Eastwood <eric.eastwood@beta.gouv.fr>
Diffstat (limited to 'synapse/storage/databases/main/sliding_sync.py')
-rw-r--r--synapse/storage/databases/main/sliding_sync.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/storage/databases/main/sliding_sync.py b/synapse/storage/databases/main/sliding_sync.py

index f2df37fec1..7b357c1ffe 100644 --- a/synapse/storage/databases/main/sliding_sync.py +++ b/synapse/storage/databases/main/sliding_sync.py
@@ -386,8 +386,8 @@ class SlidingSyncStore(SQLBaseStore): required_state_map: Dict[int, Dict[str, Set[str]]] = {} for row in rows: state = required_state_map[row[0]] = {} - for event_type, state_keys in db_to_json(row[1]): - state[event_type] = set(state_keys) + for event_type, state_key in db_to_json(row[1]): + state.setdefault(event_type, set()).add(state_key) # Get all the room configs, looking up the required state from the map # above.