From 0e3216c4009281407b4b3b43e2edde135ad54566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?X=C3=A9fir=20Destiny?= Date: Sun, 5 Jan 2020 11:17:58 +0100 Subject: [PATCH] Fix crash (oups) --- connectors.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/connectors.py b/connectors.py index 9a5d345..99ee2f3 100644 --- a/connectors.py +++ b/connectors.py @@ -35,13 +35,12 @@ class Cache: timestamp = datetime.now().timestamp() # clear old data - for cache_data in self.CACHE_DATA: - for connector_class in cache_data: - for connector_func in connector_class: - for connector_query in connector_func: - for connector_page in connector_query: - if connector_page['timeout'] < timestamp: - del connector_query + for connector_class in list(self.CACHE_DATA): + for connector_func in list(self.CACHE_DATA[connector_class]): + for connector_query in list(self.CACHE_DATA[connector_class][connector_func]): + for connector_page in list(self.CACHE_DATA[connector_class][connector_func][connector_query]): + if self.CACHE_DATA[connector_class][connector_func][connector_query][connector_page]['timeout'] < timestamp: + del self.CACHE_DATA[connector_class][connector_func][connector_query][connector_page] if connector.__class__.__name__ not in self.CACHE_DATA: self.CACHE_DATA[connector.__class__.__name__] = {}