mirror of https://github.com/CIRCL/lookyloo
chg: Few more improvements in cache.
parent
b1d30cadcf
commit
5cc51b3e3e
|
@ -18,6 +18,7 @@ from har2tree import CrawledTree, Har2TreeError, HarFile
|
|||
from redis import Redis
|
||||
|
||||
from .context import Context
|
||||
from .helpers import get_captures_dir
|
||||
from .indexing import Indexing
|
||||
from .default import LookylooException, try_make_file, get_config
|
||||
from .exceptions import MissingCaptureDirectory, NoValidHarFile, MissingUUID, TreeNeedsRebuild
|
||||
|
@ -289,7 +290,11 @@ class CapturesIndex(Mapping):
|
|||
cache['parent'] = f.read().strip()
|
||||
|
||||
p = self.redis.pipeline()
|
||||
if capture_dir.is_relative_to(get_captures_dir()):
|
||||
p.hset('lookup_dirs', uuid, str(capture_dir))
|
||||
else:
|
||||
p.hset('lookup_dirs_archived', uuid, str(capture_dir))
|
||||
|
||||
p.hset(str(capture_dir), mapping=cache) # type: ignore
|
||||
p.execute()
|
||||
return CaptureCache(cache)
|
||||
|
|
|
@ -978,8 +978,8 @@ class Lookyloo():
|
|||
continue
|
||||
try:
|
||||
archived.append(CaptureCache(cache))
|
||||
except Exception:
|
||||
continue
|
||||
except LookylooException as e:
|
||||
self.logger.warning(f'Unable load cache for {cache.get("uuid")} - {e}.')
|
||||
|
||||
for cache in self.sorted_capture_cache() + archived:
|
||||
date_submission: datetime = cache.timestamp
|
||||
|
|
Loading…
Reference in New Issue