mirror of
https://github.com/ish-app/ish.git
synced 2026-01-18 13:57:29 +00:00
Fun quirk of sqlite is that if you BEGIN DEFERRED and then do a read statement and then another process concurrently does a write and then the first process does a write statement on the same transaction, it will immediately return SQLITE_BUSY because it's impossible to do a write against a past version of the database. To fix this we need to use BEGIN IMMEDIATE to take a write lock upfront on any transaction that will need to write.