From 6b10e74470e851326a5fc9942d66a414e2020460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Fri, 5 Apr 2019 14:48:25 +0200 Subject: [PATCH] fix: do not initialize the redis cache more than once. --- lookyloo/lookyloo.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lookyloo/lookyloo.py b/lookyloo/lookyloo.py index 748fe5c1..d7c8a2f6 100644 --- a/lookyloo/lookyloo.py +++ b/lookyloo/lookyloo.py @@ -68,8 +68,9 @@ class Lookyloo(): cache = {'uuid': uuid, 'title': title} if (report_dir / 'no_index').exists(): # If the folders claims anonymity cache['no_index'] = 1 - self.redis.hmset(str(report_dir), cache) - self.redis.hset('lookup_dirs', uuid, str(report_dir)) + if uuid and not self.redis.hexists('lookup_dirs', uuid): + self.redis.hmset(str(report_dir), cache) + self.redis.hset('lookup_dirs', uuid, str(report_dir)) def report_cache(self, report_dir) -> dict: if isinstance(report_dir, Path):