diff options
author | David Robertson <davidr@element.io> | 2023-03-22 17:15:34 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-22 17:15:34 +0000 |
commit | 3b0083c92adf76daf4161908565de9e5efc08074 (patch) | |
tree | cc8e3883ec269a1153cd40b42eee5f737d906411 /synapse/state | |
parent | Merge branch 'release-v1.80' into develop (diff) | |
download | synapse-3b0083c92adf76daf4161908565de9e5efc08074.tar.xz |
Use immutabledict instead of frozendict (#15113)
Additionally: * Consistently use `freeze()` in test --------- Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'synapse/state')
-rw-r--r-- | synapse/state/__init__.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/synapse/state/__init__.py b/synapse/state/__init__.py index 4dc25df67e..6031095249 100644 --- a/synapse/state/__init__.py +++ b/synapse/state/__init__.py @@ -33,7 +33,7 @@ from typing import ( ) import attr -from frozendict import frozendict +from immutabledict import immutabledict from prometheus_client import Counter, Histogram from synapse.api.constants import EventTypes @@ -105,14 +105,18 @@ class _StateCacheEntry: # # This can be None if we have a `state_group` (as then we can fetch the # state from the DB.) - self._state = frozendict(state) if state is not None else None + self._state: Optional[StateMap[str]] = ( + immutabledict(state) if state is not None else None + ) # the ID of a state group if one and only one is involved. # otherwise, None otherwise? self.state_group = state_group self.prev_group = prev_group - self.delta_ids = frozendict(delta_ids) if delta_ids is not None else None + self.delta_ids: Optional[StateMap[str]] = ( + immutabledict(delta_ids) if delta_ids is not None else None + ) async def get_state( self, |