mirror of
https://github.com/Novartis/cellxgene-gateway.git
synced 2026-10-08 11:08:12 +08:00
#4 added failing test for cache pruning
This commit is contained in:
@@ -21,17 +21,20 @@ class PruneProcessCache:
|
||||
def __call__(self):
|
||||
while True:
|
||||
time.sleep(60)
|
||||
self.prune()
|
||||
|
||||
timestamp = current_time_stamp()
|
||||
def prune(self):
|
||||
timestamp = current_time_stamp()
|
||||
|
||||
processes_to_delete = []
|
||||
for p in self.cache.entry_list:
|
||||
if timestamp - p.timestamp > (3600 if ttl is None else ttl):
|
||||
processes_to_delete.append(p)
|
||||
processes_to_delete
|
||||
processes_to_delete = []
|
||||
for p in self.cache.entry_list:
|
||||
if timestamp - p.timestamp > (3600 if ttl is None else ttl):
|
||||
processes_to_delete.append(p)
|
||||
processes_to_delete
|
||||
|
||||
for process in processes_to_delete:
|
||||
try:
|
||||
cache.prune(process)
|
||||
except Exception:
|
||||
logging.getLogger("werkzeug").exception("failed to prune process")
|
||||
|
||||
for process in processes_to_delete:
|
||||
try:
|
||||
cache.prune(process)
|
||||
except Exception:
|
||||
logging.getLogger("werkzeug").exception("failed to prune process")
|
||||
|
||||
Reference in New Issue
Block a user