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
|