Fix SQLite WAL mode error on FUSE filesystems
WAL mode can fail on filesystems like mergerfs that don't fully support memory-mapped files. Add graceful fallback to DELETE journal mode. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
55d46d1f61
commit
d85eb36a72
|
|
@ -245,7 +245,13 @@ def connect_db(path: Path | None = None) -> sqlite3.Connection:
|
|||
ensure_db_directory(db_path)
|
||||
conn = sqlite3.connect(db_path)
|
||||
conn.row_factory = sqlite3.Row
|
||||
conn.execute("PRAGMA journal_mode=WAL;")
|
||||
# WAL mode provides better concurrency but may not work on all filesystems
|
||||
# (e.g., some FUSE filesystems like mergerfs). Fall back gracefully.
|
||||
try:
|
||||
conn.execute("PRAGMA journal_mode=WAL;")
|
||||
except sqlite3.OperationalError:
|
||||
# Fall back to DELETE journal mode which works everywhere
|
||||
conn.execute("PRAGMA journal_mode=DELETE;")
|
||||
conn.execute("PRAGMA foreign_keys=ON;")
|
||||
return conn
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue