mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Don't allow _upsert_files failure to cancel entire refresh.
This commit is contained in:
parent
478f380b0c
commit
29c352b423
1 changed files with 8 additions and 2 deletions
|
|
@ -446,13 +446,19 @@ async def refresh_discover_paths(paths: List[pathlib.Path], idempotency: datetim
|
|||
files.extend(new_files)
|
||||
if len(files) >= 100:
|
||||
# Wait until there are enough files to perform the upsert.
|
||||
_upsert_files(files, idempotency)
|
||||
try:
|
||||
_upsert_files(files, idempotency)
|
||||
except Exception as e:
|
||||
logger.error(f'Failed to upsert files', exc_info=e)
|
||||
files = list()
|
||||
# Sleep to catch cancel.
|
||||
await asyncio.sleep(0)
|
||||
if files:
|
||||
# Not enough files for the chunks above, finish what is left.
|
||||
_upsert_files(files, idempotency)
|
||||
try:
|
||||
_upsert_files(files, idempotency)
|
||||
except Exception as e:
|
||||
logger.error(f'Failed to upsert files', exc_info=e)
|
||||
|
||||
with get_db_curs(commit=True) as curs:
|
||||
wheres = ''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue