Skip to content

Commit d67dbb6

Browse files
Revert unnecessary DB connection changes
1 parent d88f75a commit d67dbb6

3 files changed

Lines changed: 5 additions & 21 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 (784 commits)
306+
- crocodilestick (783 commits)
307307
- jmarmstrong1207 (73 commits)
308308
- demitrix (30 commits)
309309
- sirwolfgang (29 commits)

cps/db.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -737,22 +737,8 @@ def setup_db(cls, config_calibre_dir, app_db_path):
737737
inst.init_session()
738738

739739
# Ensure progress syncing tables exist in metadata.db (book checksums)
740-
# Use a direct connection to ensure the table is created in the file, not in-memory
741-
try:
742-
# Import inside try block to handle potential circular imports or missing modules gracefully
743-
from .progress_syncing.models import ensure_calibre_db_tables
744-
745-
# Verify dbpath exists
746-
if os.path.exists(dbpath):
747-
with sqlite3.connect(dbpath, timeout=30) as direct_conn:
748-
ensure_calibre_db_tables(direct_conn)
749-
else:
750-
log.error(f"Cannot ensure tables: metadata.db not found at {dbpath}")
751-
except Exception as e:
752-
# Log to both app log and stderr to ensure visibility in Docker logs
753-
import sys
754-
sys.stderr.write(f"ERROR: Failed to ensure progress syncing tables: {e}\n")
755-
log.error(f"Failed to ensure progress syncing tables: {e}")
740+
from .progress_syncing.models import ensure_calibre_db_tables
741+
ensure_calibre_db_tables(conn)
756742

757743
cls._init = True
758744

cps/progress_syncing/models.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,9 @@ def execute_sql(sql):
8787
try:
8888
db_list = execute_sql("PRAGMA database_list").fetchall()
8989
# Row format: (seq, name, file)
90-
# Log the database list for debugging
91-
log.debug(f"Database list: {[str(row) for row in db_list]}")
9290
is_calibre_attached = any(str(row[1]) == 'calibre' for row in db_list)
93-
except Exception as e:
94-
log.warning(f"Failed to check database list: {e}")
91+
except Exception:
92+
is_calibre_attached = False
9593

9694
table_prefix = "calibre." if is_calibre_attached else ""
9795
table_name = f"{table_prefix}book_format_checksums"

0 commit comments

Comments
 (0)