chg: do not discard capture without HAR files

They are often just captures with an error file.
pull/746/head
Raphaël Vinot 2023-07-25 20:29:27 +02:00
parent ef3432cbed
commit a18f8f9675
1 changed files with 4 additions and 7 deletions

View File

@ -38,6 +38,10 @@ class BackgroundIndexer(AbstractManager):
# 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.')
continue continue
if not list(uuid_path.parent.rglob('*.har.gz')) and not list(uuid_path.parent.rglob('*.har')):
# No HAR file
self.logger.debug(f'{uuid_path.parent} has no HAR file.')
continue
if is_locked(uuid_path.parent): if is_locked(uuid_path.parent):
# it is really locked # it is really locked
@ -47,13 +51,6 @@ class BackgroundIndexer(AbstractManager):
with uuid_path.open() as f: with uuid_path.open() as f:
uuid = f.read() uuid = f.read()
if not list(uuid_path.parent.rglob('*.har.gz')) and not list(uuid_path.parent.rglob('*.har')):
# No HAR file
self.logger.warning(f'{uuid_path.parent} has no HAR file.')
self.lookyloo.redis.hdel('lookup_dirs', uuid)
shutil.move(str(uuid_path.parent), str(self.discarded_captures_dir / uuid_path.parent.name))
continue
if not self.lookyloo.redis.hexists('lookup_dirs', uuid): if not self.lookyloo.redis.hexists('lookup_dirs', uuid):
# The capture with this UUID exists, but it is for some reason missing in lookup_dirs # The capture with this UUID exists, but it is for some reason missing in lookup_dirs
self.lookyloo.redis.hset('lookup_dirs', uuid, str(uuid_path.parent)) self.lookyloo.redis.hset('lookup_dirs', uuid, str(uuid_path.parent))