fix: do not initialize the redis cache more than once.

pull/42/head
Raphaël Vinot 2019-04-05 14:48:25 +02:00
parent 9ef9fef655
commit 6b10e74470
1 changed files with 3 additions and 2 deletions

View File

@ -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):