mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-11-19 18:46:43 +00:00
Add retry logic for failed file copy (#261)
This commit is contained in:
1 parent
ff44881415
commit
e4d3a372c8
1 file changed
+6
-2
+6
-2
@@ -180,8 +180,12 @@ def _download_book_with_cancellation(book_id: str, cancel_flag: Event) -> Option
|
||||
try:
|
||||
shutil.move(book_path, intermediate_path)
|
||||
except Exception as e:
|
||||
logger.debug(f"Error moving book: {e}, will try copying instead")
|
||||
shutil.copy(book_path, intermediate_path)
|
||||
try:
|
||||
logger.debug(f"Error moving book: {e}, will try copying instead")
|
||||
shutil.move(book_path, intermediate_path)
|
||||
except Exception as e:
|
||||
logger.debug(f"Error copying book: {e}, will try copying without permissions instead")
|
||||
shutil.copyfile(book_path, intermediate_path)
|
||||
os.remove(book_path)
|
||||
|
||||
# Final cancellation check before completing
|
||||
|
||||
Reference in new issue
Block a user