summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-12-23 11:48:03 +0000
committerMark Haines <mark.haines@matrix.org>2015-12-23 11:48:03 +0000
commit7fa71e32670aa0ed2b49d04fd3c66a72e8fbc1cf (patch)
tree4dfce06d1cba69874edb0475c9102892e28723fb /synapse
parentMove the doc string to the public facing method (diff)
downloadsynapse-7fa71e32670aa0ed2b49d04fd3c66a72e8fbc1cf.tar.xz
Add a unit test for the snapshot cache
Diffstat (limited to 'synapse')
-rw-r--r--synapse/util/caches/snapshot_cache.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/util/caches/snapshot_cache.py b/synapse/util/caches/snapshot_cache.py
index b19aca05ab..8a7ca47a86 100644
--- a/synapse/util/caches/snapshot_cache.py
+++ b/synapse/util/caches/snapshot_cache.py
@@ -28,14 +28,14 @@ class SnapshotCache(object):
 
     def rotate(self, time_now_ms):
         # Rotate once if the cache duration has passed since the last rotation.
-        if time_now_ms - self.time_last_rotated_ms > self.DURATION_MS:
+        if time_now_ms - self.time_last_rotated_ms >= self.DURATION_MS:
             self.prev_result_cache = self.next_result_cache
             self.next_result_cache = {}
             self.time_last_rotated_ms += self.DURATION_MS
 
         # Rotate again if the cache duration has passed twice since the last
         # rotation.
-        if time_now_ms - self.time_last_rotated_ms > self.DURATION_MS:
+        if time_now_ms - self.time_last_rotated_ms >= self.DURATION_MS:
             self.prev_result_cache = self.next_result_cache
             self.next_result_cache = {}
             self.time_last_rotated_ms = time_now_ms