fix: skip root directory when scanning on s3fs

pull/833/head
Raphaël Vinot 2023-11-16 22:55:44 +01:00
parent 0182dbeb23
commit f209ef22f1
1 changed files with 4 additions and 1 deletions

View File

@ -99,6 +99,9 @@ class Archiver(AbstractManager):
# * <datetime>
# * <day> (which contains a <datetime> directory)
for entry in self.s3fs_client.ls(s3fs_dir, detail=False, refresh=False):
if entry.endswith('/'):
# root directory
continue
if not self.s3fs_client.isdir(entry):
# index
continue
@ -336,7 +339,7 @@ class Archiver(AbstractManager):
self.logger.warning('Shutdown requested, breaking.')
break
self.logger.info(f'Loading {index}')
self.logger.debug(f'Loading {index}')
if recent_uuids := self.__load_index(index):
self.logger.debug(f'{len(recent_uuids)} captures in directory {index.parent}.')
self.redis.hset('lookup_dirs', mapping=recent_uuids) # type: ignore