summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-04-01 17:33:24 +0100
committerErik Johnston <erik@matrix.org>2021-04-01 17:33:24 +0100
commit5deb349a7ff65aecaecfe5eb69136217f7940bd6 (patch)
treedd5caa47daf47dfa1ac78ee41a77580e9beb43bf
parentSmear (diff)
downloadsynapse-5deb349a7ff65aecaecfe5eb69136217f7940bd6.tar.xz
Fixup
-rw-r--r--synapse/util/caches/lrucache.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/synapse/util/caches/lrucache.py b/synapse/util/caches/lrucache.py
index 4db6dd2254..9f5928b2f1 100644
--- a/synapse/util/caches/lrucache.py
+++ b/synapse/util/caches/lrucache.py
@@ -170,6 +170,7 @@ class LruCache(Generic[KT, VT]):
         list_root = _Node(None, None, None, None)
         list_root.next_node = list_root
         list_root.prev_node = list_root
+        list_root.allocated_ts = -1
 
         lock = threading.Lock()
 
@@ -178,7 +179,7 @@ class LruCache(Generic[KT, VT]):
             ten_minutes_ago = int(reactor.seconds()) - 10 * 60
             while i < 100 and (
                 cache_len() > self.max_size
-                or list_root.prev_node.allocated_ts < ten_minutes_ago + 60
+                or 0 < list_root.prev_node.allocated_ts < ten_minutes_ago + 60
             ):
                 i += 1
                 if list_root.prev_node.allocated_ts > ten_minutes_ago: