Raise the busy timeout
The default busy timeout is 0 and in the default configuration read-blocks-write. Thus by default it is extremely easy for concurrent requests to the server to block each other. So easy I can reproduce it with about 100% fidelity in trivial local testing. The transactions are all short lived, though, so re-attempting the lock acquisition for for up to a second dramatically reduces the failure rate. On a busy enough server it's conceivable a request might have to wait a full second behind other requests to get access to the database. In this case the request will fail with the same "database is locked" error. When that time comes, it is probably worth just provisioning a faster server. Or we could explore WAL mode where read *doesn't* block write (though you can still only have one writer and our API is pretty write heavy).
Loading
Please register or sign in to comment