summary refs log tree commit diff
path: root/synapse/util/caches/stream_change_cache.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-09-15 15:12:07 +0100
committerErik Johnston <erik@matrix.org>2016-09-15 15:12:07 +0100
commit955f34d23e03c30c5c85df542e3b9b8bf9970110 (patch)
tree26b8c438a4d76464a870d656ab319f7f4b204fd7 /synapse/util/caches/stream_change_cache.py
parentUse stream_change cache to make get_forward_extremeties_for_room cache more e... (diff)
downloadsynapse-955f34d23e03c30c5c85df542e3b9b8bf9970110.tar.xz
Change get_pos_of_last_change to return upper bound
Diffstat (limited to 'synapse/util/caches/stream_change_cache.py')
-rw-r--r--synapse/util/caches/stream_change_cache.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/synapse/util/caches/stream_change_cache.py b/synapse/util/caches/stream_change_cache.py
index 5c2a433e41..b72bb0ff02 100644
--- a/synapse/util/caches/stream_change_cache.py
+++ b/synapse/util/caches/stream_change_cache.py
@@ -122,7 +122,8 @@ class StreamChangeCache(object):
                 self._earliest_known_stream_pos = max(k, self._earliest_known_stream_pos)
                 self._entity_to_key.pop(r, None)
 
-    def get_pos_of_last_change(self, entity):
-        """Returns the stream pos of the last change for an entitiy, if known.
+    def get_max_pos_of_last_change(self, entity):
+        """Returns an upper bound of the stream id of the last change to an
+        entity.
         """
-        return self._entity_to_key.get(entity, None)
+        return self._entity_to_key.get(entity, self._earliest_known_stream_pos)