From 9602d908af147c5d8b97895034b48cba8934b0b8 Mon Sep 17 00:00:00 2001 From: sgoudham Date: Sat, 22 Aug 2020 20:39:30 +0100 Subject: [PATCH] Fixing edge case Updated commentary --- bot/libs/cache.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bot/libs/cache.py b/bot/libs/cache.py index 43d58d85..ea4262ab 100644 --- a/bot/libs/cache.py +++ b/bot/libs/cache.py @@ -88,6 +88,9 @@ class MyCoolCache: if input_size > self.MAX_SIZE: self.queue.MAX_SIZE = input_size self.MAX_SIZE = input_size + elif self.MAX_SIZE > input_size > len(self.queue.values): + self.queue.MAX_SIZE = input_size + self.MAX_SIZE = input_size else: # Split Array into 2 and iterate through the queue and delete things for value in self.queue.values[input_size:]: