Wait on a busy SQLite database and turn on WAL mode (closes #198) #200

Merged
clawbot merged 2 commits from issue-198-sqlite-busy-timeout-wal into next 2026-10-04 20:58:37 +02:00
2 Commits
Author SHA1 Message Date
clawbot c33713c85f Wait on a busy SQLite database and turn on WAL mode (closes #198)
check / check (push) Failing after 2s
Requests and the eviction pass write on separate connections, and with
no busy timeout a write that met another one failed at once with
"database is locked" and was lost. internal/database now adds
_pragma=busy_timeout(5000) to every db_url, the default or one the
operator sets, so such a write waits up to five seconds. The default
db_url's _journal_mode=WAL is not a parameter the driver reads, so it
is now _pragma=journal_mode(WAL). README.md and config.example.yml say
what pixa adds to db_url.

Model: opus-5-5
2026-10-04 18:34:12 +00:00
clawbot 11d0393704 Test that concurrent SQLite writes succeed and the default db_url uses WAL
check / check (push) Failing after 3s
Adds two tests that fail before the fix. One opens the database the way
pixad does and makes writes like one request's and the eviction pass's
from several goroutines at once; on separate connections with no busy
timeout, some fail with "database is locked". The other opens the db_url
derived from state_dir and checks the database is in WAL mode, which the
current default's _journal_mode=WAL does not do because the driver
ignores that parameter. The expected default db_url in
TestOmittedValuesUseDefaults changes to the new one.

Model: opus-5-5
2026-10-04 18:30:17 +00:00