1
0
This commit is contained in:
Erik Johnston
2021-04-01 17:33:24 +01:00
parent 2e78ef4d22
commit 5deb349a7f

View File

@@ -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: