summary refs log tree commit diff
path: root/synapse/util/caches/stream_change_cache.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-06-09 15:30:55 +0100
committerGitHub <noreply@github.com>2017-06-09 15:30:55 +0100
commit1e9b4d5a95f265430de382e7a9b230800f2ad0e0 (patch)
tree76c1d04fd326e7926c8863f73c32cad6223f9e9d /synapse/util/caches/stream_change_cache.py
parentMerge pull request #2267 from matrix-org/erikj/missing_notifier (diff)
parentRewrite conditional (diff)
downloadsynapse-1e9b4d5a95f265430de382e7a9b230800f2ad0e0.tar.xz
Merge pull request #2268 from matrix-org/erikj/entity_has_changed
Fix has_any_entity_changed
Diffstat (limited to 'synapse/util/caches/stream_change_cache.py')
-rw-r--r--synapse/util/caches/stream_change_cache.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/synapse/util/caches/stream_change_cache.py b/synapse/util/caches/stream_change_cache.py
index c498aee46c..609625b322 100644
--- a/synapse/util/caches/stream_change_cache.py
+++ b/synapse/util/caches/stream_change_cache.py
@@ -96,10 +96,10 @@ class StreamChangeCache(object):
 
         if stream_pos >= self._earliest_known_stream_pos:
             self.metrics.inc_hits()
-            if stream_pos >= max(self._cache):
-                return False
-            else:
-                return True
+            keys = self._cache.keys()
+            i = keys.bisect_right(stream_pos)
+
+            return i < len(keys)
         else:
             self.metrics.inc_misses()
             return True