chg: Improve readability of the background indexer

pull/746/head
Raphaël Vinot 2023-07-30 16:59:41 +02:00
parent 182e7af188
commit 4be8186cc6
2 changed files with 6 additions and 1 deletions

View File

@ -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.')

View File

@ -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: