1.6 KiB
1.6 KiB
| id | type | title | tags | importance | confidence | created | updated | relations | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 8028aeb5-d922-49aa-b0e6-fbc1cce35484 | fix | Fix: Document SQLite synchronous=0 pragma in paper-dynasty-database |
|
0.5 | 0.8 | 2026-03-04T01:32:49.610296+00:00 | 2026-03-04T01:32:51.174263+00:00 |
|
Problem
app/db_engine.py:36 had pragmas={"synchronous": 0} with no explanation. synchronous=0 (OFF) skips fsync on writes — fast but risks DB corruption on hard crash.
Context
- SQLite branch is dev-only; production uses PostgreSQL (
DATABASE_TYPEenv var) - WAL journal mode (
journal_mode=wal) partially mitigates the corruption window - Trade-off is acceptable in dev (data loss tolerable, write speed prioritised)
Solution
Added a block comment above the SQLite SqliteDatabase(...) call explaining:
synchronous=0behaviour and crash-corruption risk- Why it's acceptable in dev (not used in production)
- How WAL mode reduces (but doesn't eliminate) the risk
Files Changed
app/db_engine.py— comment at SQLite branch (line ~33)
PR
cal/paper-dynasty-database#49 (issue #20)