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 redis import Redis
|
||||||
|
|
||||||
from .context import Context
|
from .context import Context
|
||||||
|
from .helpers import get_captures_dir
|
||||||
from .indexing import Indexing
|
from .indexing import Indexing
|
||||||
from .default import LookylooException, try_make_file, get_config
|
from .default import LookylooException, try_make_file, get_config
|
||||||
from .exceptions import MissingCaptureDirectory, NoValidHarFile, MissingUUID, TreeNeedsRebuild
|
from .exceptions import MissingCaptureDirectory, NoValidHarFile, MissingUUID, TreeNeedsRebuild
|
||||||
|
@ -289,7 +290,11 @@ class CapturesIndex(Mapping):
|
||||||
cache['parent'] = f.read().strip()
|
cache['parent'] = f.read().strip()
|
||||||
|
|
||||||
p = self.redis.pipeline()
|
p = self.redis.pipeline()
|
||||||
p.hset('lookup_dirs', uuid, str(capture_dir))
|
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.hset(str(capture_dir), mapping=cache) # type: ignore
|
||||||
p.execute()
|
p.execute()
|
||||||
return CaptureCache(cache)
|
return CaptureCache(cache)
|
||||||
|
|
|
@ -978,8 +978,8 @@ class Lookyloo():
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
archived.append(CaptureCache(cache))
|
archived.append(CaptureCache(cache))
|
||||||
except Exception:
|
except LookylooException as e:
|
||||||
continue
|
self.logger.warning(f'Unable load cache for {cache.get("uuid")} - {e}.')
|
||||||
|
|
||||||
for cache in self.sorted_capture_cache() + archived:
|
for cache in self.sorted_capture_cache() + archived:
|
||||||
date_submission: datetime = cache.timestamp
|
date_submission: datetime = cache.timestamp
|
||||||
|
|
Loading…
Reference in New Issue