Skip to content

Commit e83d9f2

Browse files
Fix ingest processor test path and add DB debugging
1 parent 92be461 commit e83d9f2

3 files changed

Lines changed: 20 additions & 7 deletions

File tree

CONTRIBUTORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ Copyright (C) 2024-2025 Calibre-Web Automated contributors
303303
- zhiyue (1 commits)
304304
# Fork Contributors (crocodilestick/calibre-web-automated)
305305

306-
- crocodilestick (778 commits)
306+
- crocodilestick (780 commits)
307307
- jmarmstrong1207 (73 commits)
308308
- demitrix (30 commits)
309309
- sirwolfgang (29 commits)

cps/progress_syncing/models.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,16 @@ def execute_sql(sql):
8686
try:
8787
db_list = execute_sql("PRAGMA database_list").fetchall()
8888
# Row format: (seq, name, file)
89+
# Log the database list for debugging
90+
log.info(f"Database list: {[str(row) for row in db_list]}")
8991
is_calibre_attached = any(str(row[1]) == 'calibre' for row in db_list)
90-
except Exception:
92+
except Exception as e:
93+
log.warning(f"Failed to check database list: {e}")
9194
is_calibre_attached = False
9295

96+
if not is_calibre_attached:
97+
log.warning("Calibre database not attached. Creating table in main schema (in-memory?). This may cause persistence issues.")
98+
9399
table_prefix = "calibre." if is_calibre_attached else ""
94100
table_name = f"{table_prefix}book_format_checksums"
95101
master_table = f"{table_prefix}sqlite_master"

scripts/ingest_processor.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,18 @@ def gdrive_sync_if_enabled():
242242
print(f"[ingest-processor] WARN: Could not ensure processed_books directories: {e}", flush=True)
243243

244244
# Generates dictionary of available backup directories and their paths
245-
backup_destinations = {
246-
entry.name: entry.path
247-
for entry in os.scandir("/config/processed_books")
248-
if entry.is_dir()
249-
}
245+
try:
246+
backup_destinations = {
247+
entry.name: entry.path
248+
for entry in os.scandir("/config/processed_books")
249+
if entry.is_dir()
250+
}
251+
except FileNotFoundError:
252+
# Fallback for test environments where /config might not exist
253+
backup_destinations = {}
254+
except Exception as e:
255+
print(f"[ingest-processor] WARN: Could not scan processed_books: {e}", flush=True)
256+
backup_destinations = {}
250257

251258
class NewBookProcessor:
252259
def __init__(self, filepath: str):

0 commit comments

Comments
 (0)