diff options
author | Erik Johnston <erik@matrix.org> | 2016-01-28 18:11:41 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-01-28 18:11:41 +0000 |
commit | 3f5dd18bd44ae426d3b1ff062dd64acbad72f8ae (patch) | |
tree | 286ee214e45c582820d62477f33523e786e4f38c /synapse/util/caches | |
parent | Correctly update _entity_to_key (diff) | |
download | synapse-3f5dd18bd44ae426d3b1ff062dd64acbad72f8ae.tar.xz |
If the same as the earliest key, assume nothing has changed.
Diffstat (limited to 'synapse/util/caches')
-rw-r--r-- | synapse/util/caches/stream_change_cache.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/util/caches/stream_change_cache.py b/synapse/util/caches/stream_change_cache.py index 22a9f8f467..c673b1bdfc 100644 --- a/synapse/util/caches/stream_change_cache.py +++ b/synapse/util/caches/stream_change_cache.py @@ -49,6 +49,11 @@ class StreamChangeCache(object): cache_counter.inc_misses(self.name) return True + if stream_pos == self._earliest_known_stream_pos: + # If the same as the earliest key, assume nothing has changed. + cache_counter.inc_hits(self.name) + return False + latest_entity_change_pos = self._entity_to_key.get(entity, None) if latest_entity_change_pos is None: cache_counter.inc_misses(self.name) |