summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorOlivier 'reivilibre <oliverw@matrix.org>2024-07-30 18:07:35 +0100
committerOlivier 'reivilibre <oliverw@matrix.org>2024-07-30 18:07:35 +0100
commited583d9c815520f94a7267e7ef0dbb7977e57189 (patch)
tree123e3d6a8ffa77a12f7bf219fb63c8b801b0f5e9 /synapse/util
parentAdd bold emphasis to some parts of the changelog (diff)
parent1.112.0 (diff)
downloadsynapse-master.tar.xz
Merge branch 'release-v1.112' github/master master
Diffstat (limited to '')
-rw-r--r--synapse/util/caches/stream_change_cache.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/synapse/util/caches/stream_change_cache.py b/synapse/util/caches/stream_change_cache.py

index 91c335f85b..16fcb00206 100644 --- a/synapse/util/caches/stream_change_cache.py +++ b/synapse/util/caches/stream_change_cache.py
@@ -327,7 +327,7 @@ class StreamChangeCache: for entity in r: self._entity_to_key.pop(entity, None) - def get_max_pos_of_last_change(self, entity: EntityType) -> int: + def get_max_pos_of_last_change(self, entity: EntityType) -> Optional[int]: """Returns an upper bound of the stream id of the last change to an entity. @@ -335,7 +335,11 @@ class StreamChangeCache: entity: The entity to check. Return: - The stream position of the latest change for the given entity or - the earliest known stream position if the entitiy is unknown. + The stream position of the latest change for the given entity, if + known """ - return self._entity_to_key.get(entity, self._earliest_known_stream_pos) + return self._entity_to_key.get(entity) + + def get_earliest_known_position(self) -> int: + """Returns the earliest position in the cache.""" + return self._earliest_known_stream_pos