From 5deb349a7ff65aecaecfe5eb69136217f7940bd6 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 1 Apr 2021 17:33:24 +0100 Subject: [PATCH] Fixup --- synapse/util/caches/lrucache.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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: