Make concurrent database writes wait instead of failing (closes #253) #258

Merged
clawbot merged 1 commits from issue-253-sqlite-busy-timeout into next 2026-10-01 22:16:15 +02:00
1 Commits
Author SHA1 Message Date
sneak dd4e9ad4f0 Make concurrent database writes wait instead of failing (closes #253)
Check / check (pull_request) Skipped
SQLite transactions started deferred, so two that both read and then
wrote could not both proceed, and SQLite refused the second at once with
"database is locked" without waiting. TestCreateUserRaceCondition hit
this now and then.

The database is now opened with _txlock=immediate, so each transaction
takes the write lock when it begins and a second one waits for it, and
with _busy_timeout=5000, so that wait lasts up to 5 seconds. The driver
already defaults to 5000; it is now stated in the code.

Model: opus-5-5
2026-10-01 20:00:21 +00:00