File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -364,10 +364,21 @@ async def remove_from_index(self, file_location: str) -> None:
364
364
365
365
self .changed = True
366
366
367
+ @retry (
368
+ stop = stop_after_attempt (1000 ),
369
+ wait = wait_random_exponential (multiplier = 0.25 , max = 60 ),
370
+ retry = retry_if_exception_type (AsyncRetryError ),
371
+ reraise = True ,
372
+ )
367
373
async def save_index (self ) -> None :
368
- async with self .writer (reset = True ) as writer :
369
- writer .commit ()
370
- writer .wait_merging_threads ()
374
+ try :
375
+ async with self .writer (reset = True ) as writer :
376
+ writer .commit ()
377
+ writer .wait_merging_threads ()
378
+ except ValueError as e :
379
+ if "Failed to acquire Lockfile: LockBusy." in str (e ):
380
+ raise AsyncRetryError ("Failed to acquire lock" ) from e
381
+ raise
371
382
file_index_path = await self .file_index_filename
372
383
async with await anyio .open_file (file_index_path , "wb" ) as f :
373
384
await f .write (zlib .compress (pickle .dumps (await self .index_files )))
You can’t perform that action at this time.
0 commit comments