mirror of https://github.com/CIRCL/lookyloo
chg: Improve readability of the background indexer
parent
182e7af188
commit
4be8186cc6
|
@ -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
|
# This value makes sure we break out of the loop and build pickles of the most recent captures
|
||||||
max_captures = 50
|
max_captures = 50
|
||||||
got_new_captures = False
|
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()):
|
if ((uuid_path.parent / 'tree.pickle.gz').exists() or (uuid_path.parent / 'tree.pickle').exists()):
|
||||||
# We already have a pickle file
|
# We already have a pickle file
|
||||||
self.logger.debug(f'{uuid_path.parent} has a pickle.')
|
self.logger.debug(f'{uuid_path.parent} has a pickle.')
|
||||||
|
|
|
@ -841,6 +841,11 @@ def pandora_submit(tree_uuid: str):
|
||||||
# ##### helpers #####
|
# ##### helpers #####
|
||||||
|
|
||||||
def index_generic(show_hidden: bool=False, show_error: bool=True, category: Optional[str]=None):
|
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 = []
|
titles = []
|
||||||
cut_time: Optional[datetime] = None
|
cut_time: Optional[datetime] = None
|
||||||
if time_delta_on_index:
|
if time_delta_on_index:
|
||||||
|
|
Loading…
Reference in New Issue