Better `all_entities_changed(stream_pos)` implementation

See https://github.com/element-hq/synapse/pull/17732#discussion_r1765815711
This commit is contained in:
Eric Eastwood 2024-12-18 18:58:46 -06:00
parent 7e328d7ee7
commit ac06ddfb02
1 changed files with 3 additions and 5 deletions

View File

@ -319,11 +319,9 @@ class StreamChangeCache:
Mark all entities as changed. This is useful when the cache is invalidated and
there may be some potential change for all of the entities.
"""
# All entities are at the same stream position now.
self._cache = SortedDict({stream_pos: set(self._entity_to_key.keys())})
self._entity_to_key = {
entity: stream_pos for entity in self._entity_to_key.keys()
}
self._cache.clear()
self._entity_to_key.clear()
self._earliest_known_stream_pos = stream_pos
def _evict(self) -> None:
"""