From fa6b4701c0a9f4ecaf744416aec48fef81bcd30a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Sat, 20 Mar 2021 21:54:46 +0100 Subject: [PATCH] chg: update the cache at the right place. --- bin/background_indexer.py | 5 +---- lookyloo/lookyloo.py | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/background_indexer.py b/bin/background_indexer.py index 570fcab8..4f4873b3 100755 --- a/bin/background_indexer.py +++ b/bin/background_indexer.py @@ -36,6 +36,7 @@ class BackgroundIndexer(AbstractManager): try: self.logger.info(f'Build pickle for {uuid}: {uuid_path.parent.name}') self.lookyloo.get_crawled_tree(uuid) + self.logger.info(f'Pickle for {uuid} build.') except NoValidHarFile: self.logger.warning(f'Unable to build pickle for {uuid}: {uuid_path.parent.name}') # The capture is not working, moving it away. @@ -44,10 +45,6 @@ class BackgroundIndexer(AbstractManager): def _check_indexes(self): for cache in self.lookyloo.sorted_capture_cache(): - if cache.incomplete_redirects: - # FIXME: this is dirty and needs to be moved. - self.lookyloo._set_capture_cache(cache.capture_dir, force=True) - cache = self.lookyloo.capture_cache(cache.uuid) # type: ignore if self.lookyloo.is_public_instance and cache.no_index: # Capture unindexed continue diff --git a/lookyloo/lookyloo.py b/lookyloo/lookyloo.py index caa85da6..99d6cb9e 100644 --- a/lookyloo/lookyloo.py +++ b/lookyloo/lookyloo.py @@ -485,6 +485,9 @@ class Lookyloo(): if not c: continue c = CaptureCache(c) + if c.incomplete_redirects: + self._set_capture_cache(c.capture_dir, force=True) + c = self.capture_cache(c.uuid) if hasattr(c, 'timestamp'): all_cache.append(c) all_cache.sort(key=operator.attrgetter('timestamp'), reverse=True)