From 4be8186cc6e06a73a6f3a045938c6ff6681fd296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Sun, 30 Jul 2023 16:59:41 +0200 Subject: [PATCH] chg: Improve readability of the background indexer --- bin/background_indexer.py | 2 +- website/web/__init__.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/background_indexer.py b/bin/background_indexer.py index 3f1ce91b..24a04de0 100755 --- a/bin/background_indexer.py +++ b/bin/background_indexer.py @@ -39,7 +39,7 @@ class BackgroundIndexer(AbstractManager): # This value makes sure we break out of the loop and build pickles of the most recent captures max_captures = 50 got_new_captures = False - for uuid_path in sorted(self.lookyloo.capture_dir.glob('**/uuid'), reverse=True): + for uuid_path in sorted(self.lookyloo.capture_dir.rglob('uuid'), reverse=True): if ((uuid_path.parent / 'tree.pickle.gz').exists() or (uuid_path.parent / 'tree.pickle').exists()): # We already have a pickle file self.logger.debug(f'{uuid_path.parent} has a pickle.') diff --git a/website/web/__init__.py b/website/web/__init__.py index e46e3bf0..c97d0362 100644 --- a/website/web/__init__.py +++ b/website/web/__init__.py @@ -841,6 +841,11 @@ def pandora_submit(tree_uuid: str): # ##### helpers ##### def index_generic(show_hidden: bool=False, show_error: bool=True, category: Optional[str]=None): + """This method is used to generate the index page. It is possible that some of the captures + do not have their pickle yet. + + We must assume that calling cached.tree will fail, and handle it gracefully. + """ titles = [] cut_time: Optional[datetime] = None if time_delta_on_index: