From 19c8c54b0b50342dc47a3fa5650c79bc805cb90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 22 Sep 2021 22:23:20 +0200 Subject: [PATCH] fix: force-rebuild pickle if needed. --- lookyloo/lookyloo.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lookyloo/lookyloo.py b/lookyloo/lookyloo.py index 9acf1ff1..c598e2f7 100644 --- a/lookyloo/lookyloo.py +++ b/lookyloo/lookyloo.py @@ -27,7 +27,7 @@ from werkzeug.useragents import UserAgent from .capturecache import CaptureCache, CapturesIndex from .context import Context from .exceptions import (LookylooException, MissingCaptureDirectory, - MissingUUID) + MissingUUID, TreeNeedsRebuild) from .helpers import (CaptureStatus, get_captures_dir, get_config, get_email_template, get_homedir, get_resources_hashes, get_socket_path, get_splash_url, get_taxonomies, uniq_domains) @@ -336,7 +336,11 @@ class Lookyloo(): def get_crawled_tree(self, capture_uuid: str, /) -> CrawledTree: '''Get the generated tree in ETE Toolkit format. Loads the pickle if it exists, creates it otherwise.''' - return self._captures_index[capture_uuid].tree + try: + return self._captures_index[capture_uuid].tree + except TreeNeedsRebuild: + self._captures_index.reload_cache(capture_uuid) + return self._captures_index[capture_uuid].tree def enqueue_capture(self, query: MutableMapping[str, Any], source: str, user: str, authenticated: bool) -> str: '''Enqueue a query in the capture queue (used by the UI and the API for asynchronous processing)'''