0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-16 23:11:34 +01:00

Include cache hits with has_entity_changed

This commit is contained in:
Erik Johnston 2016-01-28 17:27:28 +00:00
parent fdca8ec418
commit 0663c5bd52

View file

@ -46,15 +46,19 @@ class StreamChangeCache(object):
assert type(stream_pos) is int assert type(stream_pos) is int
if stream_pos <= self._earliest_known_stream_pos: if stream_pos <= self._earliest_known_stream_pos:
cache_counter.inc_misses(self.name)
return True return True
latest_entity_change_pos = self._entity_to_key.get(entity, None) latest_entity_change_pos = self._entity_to_key.get(entity, None)
if latest_entity_change_pos is None: if latest_entity_change_pos is None:
cache_counter.inc_misses(self.name)
return True return True
if stream_pos < latest_entity_change_pos: if stream_pos < latest_entity_change_pos:
cache_counter.inc_misses(self.name)
return True return True
cache_counter.inc_hits(self.name)
return False return False
def get_entities_changed(self, entities, stream_pos): def get_entities_changed(self, entities, stream_pos):