sync errors

This commit is contained in:
2026-05-10 20:21:23 +02:00
parent 96e555de0a
commit b1956e20f4
3 changed files with 44 additions and 17 deletions
+6
View File
@@ -81,6 +81,7 @@ def run_sync(limit: int | None = None) -> None:
books = extractor.extract(local_zip, work_dir / "extracted")
log.info("Extract done in %.1fs — %d book(s)", time.monotonic() - t1, len(books))
books_errored_this_zip = 0
for book in books:
t2 = time.monotonic()
status = client.upload(book, zip_source=remote_zip.remote_path)
@@ -91,6 +92,11 @@ def run_sync(limit: int | None = None) -> None:
counters["books_skipped"] += 1
else:
counters["books_errored"] += 1
books_errored_this_zip += 1
if books_errored_this_zip:
zip_status = "error"
zip_error = f"{books_errored_this_zip} book upload(s) failed — will retry next sync"
extractor.cleanup(work_dir / "extracted" / local_zip.stem)
except Exception as e: