-
Hi. I'm having problems, in production. Some times I get the database is locked error, I thing its not a issue, only, using the library in the right way. The problem occurs, I guess, by the concurrency. I have an open connection in the app and I also have a workmanager that runs every 15 minutes, opens another connection and reads and writes. I believe that the lock occurs there, I ask. What is the best strategy to avoid this? (Knowing that the workmanager runs regardless of the app. That is, it uses another connection with the bank) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I recently saw a similar issue (#1042). I think it should be safe to just retry when you get that exception. You could write an implementation of |
Beta Was this translation helpful? Give feedback.
I recently saw a similar issue (#1042). I think it should be safe to just retry when you get that exception. You could write an implementation of
QueryExecutor
that wraps another executor (typically aVmDatabase
) and retries if operations fail with that exception.Also, you might want to consider enabling WAL mode if you need concurrency. With WAL, a writer does not block readers (and vice-versa). Multiple concurrent writes still aren't allowed, but this might help a bit.