Skip to content

Commit b0067c6

Browse files
Use direct connection for table creation to fix persistence
1 parent e83d9f2 commit b0067c6

2 files changed

Lines changed: 8 additions & 2 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 (780 commits)
306+
- crocodilestick (781 commits)
307307
- jmarmstrong1207 (73 commits)
308308
- demitrix (30 commits)
309309
- sirwolfgang (29 commits)

cps/db.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from uuid import uuid4
1616

1717
from sqlite3 import OperationalError as sqliteOperationalError
18+
import sqlite3
1819
from sqlalchemy import create_engine
1920
from sqlalchemy import Table, Column, ForeignKey, CheckConstraint
2021
from sqlalchemy import String, Integer, Boolean, TIMESTAMP, Float
@@ -736,8 +737,13 @@ def setup_db(cls, config_calibre_dir, app_db_path):
736737
inst.init_session()
737738

738739
# 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
739741
from .progress_syncing.models import ensure_calibre_db_tables
740-
ensure_calibre_db_tables(conn)
742+
try:
743+
with sqlite3.connect(dbpath, timeout=30) as direct_conn:
744+
ensure_calibre_db_tables(direct_conn)
745+
except Exception as e:
746+
log.error(f"Failed to ensure progress syncing tables: {e}")
741747

742748
cls._init = True
743749

0 commit comments

Comments
 (0)