Skip to content

Is it safe to use the database at the same time in background and foreground (workmanager) #1059

Answered by simolus3
biessek asked this question in Q&A
Discussion options

You must be logged in to vote

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 a VmDatabase) 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.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@biessek
Comment options

@simolus3
Comment options

@biessek
Comment options

Answer selected by biessek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants