sync errors
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user