From 0fddb9aacd5600a58ef35c2214cd72d33a0ebed2 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 2 Apr 2021 11:10:25 +0100 Subject: fix --- synapse/util/caches/lrucache.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/synapse/util/caches/lrucache.py b/synapse/util/caches/lrucache.py index 2ea4a63e5a..d0767c269d 100644 --- a/synapse/util/caches/lrucache.py +++ b/synapse/util/caches/lrucache.py @@ -176,13 +176,13 @@ class LruCache(Generic[KT, VT]): def evict(): ten_minutes_ago = int(reactor.seconds()) - 10 * 60 + todelete = list_root.prev_node while ( cache_len() > self.max_size - or 0 < list_root.prev_node.allocated_ts < ten_minutes_ago + 60 + or 0 < todelete.allocated_ts < ten_minutes_ago + 60 ): - todelete = list_root.prev_node - if 0 < todelete.allocated_ts < ten_minutes_ago: + todelete = list_root.prev_node continue todelete = list_root.prev_node @@ -194,6 +194,8 @@ class LruCache(Generic[KT, VT]): if metrics: metrics.inc_evictions(evicted_len) + todelete = list_root.prev_node + def synchronized(f: FT) -> FT: @wraps(f) def inner(*args, **kwargs): -- cgit 1.5.1