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 -3
View File
@@ -110,9 +110,11 @@ def is_zip_processed(remote_path: str) -> bool:
def get_all_processed_paths() -> set[str]:
"""Return all processed remote paths as a set for fast bulk membership checks."""
"""Return successfully-processed remote paths. Errored zips are excluded so they get retried."""
with get_db() as conn:
rows = conn.execute("SELECT remote_path FROM processed_zips").fetchall()
rows = conn.execute(
"SELECT remote_path FROM processed_zips WHERE status = 'success'"
).fetchall()
return {row["remote_path"] for row in rows}
@@ -174,7 +176,8 @@ def get_recent_zips(limit: int = 50) -> list[sqlite3.Row]:
def is_book_uploaded(file_hash: str) -> bool:
with get_db() as conn:
row = conn.execute(
"SELECT id FROM uploaded_books WHERE file_hash = ?", (file_hash,)
"SELECT id FROM uploaded_books WHERE file_hash = ? AND status IN ('uploaded', 'skipped_duplicate')",
(file_hash,),
).fetchone()
return row is not None