Fix crash (oups)

This commit is contained in:
Michel Roux 2020-01-05 11:17:58 +01:00
parent 3011eb01ee
commit 0e3216c400

View File

@ -35,13 +35,12 @@ class Cache:
timestamp = datetime.now().timestamp() timestamp = datetime.now().timestamp()
# clear old data # clear old data
for cache_data in self.CACHE_DATA: for connector_class in list(self.CACHE_DATA):
for connector_class in cache_data: for connector_func in list(self.CACHE_DATA[connector_class]):
for connector_func in connector_class: for connector_query in list(self.CACHE_DATA[connector_class][connector_func]):
for connector_query in connector_func: for connector_page in list(self.CACHE_DATA[connector_class][connector_func][connector_query]):
for connector_page in connector_query: if self.CACHE_DATA[connector_class][connector_func][connector_query][connector_page]['timeout'] < timestamp:
if connector_page['timeout'] < timestamp: del self.CACHE_DATA[connector_class][connector_func][connector_query][connector_page]
del connector_query
if connector.__class__.__name__ not in self.CACHE_DATA: if connector.__class__.__name__ not in self.CACHE_DATA:
self.CACHE_DATA[connector.__class__.__name__] = {} self.CACHE_DATA[connector.__class__.__name__] = {}