diff options
author | Olivier 'reivilibre <oliverw@matrix.org> | 2024-07-30 18:07:35 +0100 |
---|---|---|
committer | Olivier 'reivilibre <oliverw@matrix.org> | 2024-07-30 18:07:35 +0100 |
commit | ed583d9c815520f94a7267e7ef0dbb7977e57189 (patch) | |
tree | 123e3d6a8ffa77a12f7bf219fb63c8b801b0f5e9 /synapse/util/caches/stream_change_cache.py | |
parent | Add bold emphasis to some parts of the changelog (diff) | |
parent | 1.112.0 (diff) | |
download | synapse-ed583d9c815520f94a7267e7ef0dbb7977e57189.tar.xz |
Merge branch 'release-v1.112' github/master master
Diffstat (limited to 'synapse/util/caches/stream_change_cache.py')
-rw-r--r-- | synapse/util/caches/stream_change_cache.py | 12 |
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 |