diff --git a/synapse/state/__init__.py b/synapse/state/__init__.py index 0a563c4ff4ee..a5e6f73aefc5 100644 --- a/synapse/state/__init__.py +++ b/synapse/state/__init__.py @@ -84,7 +84,7 @@ def _gen_state_id() -> str: class _StateCacheEntry: - __slots__ = ["state", "state_group", "prev_group", "delta_ids"] + __slots__ = ["_state", "state_group", "prev_group", "delta_ids"] def __init__( self, @@ -97,7 +97,7 @@ def __init__( raise Exception("Either state or state group must be not None") # A map from (type, state_key) to event_id. - self.state = frozendict(state) if state is not None else None + self._state = frozendict(state) if state is not None else None # the ID of a state group if one and only one is involved. # otherwise, None otherwise? @@ -115,8 +115,8 @@ async def get_state( looking up the state group in the DB. """ - if self.state is not None: - return self.state + if self._state is not None: + return self._state assert self.state_group is not None @@ -129,7 +129,7 @@ def __len__(self) -> int: # cache eviction purposes. This is why if `self.state` is None it's fine # to return 1. - return len(self.state) if self.state else 1 + return len(self._state) if self._state else 1 class StateHandler: