Hey Folks :wave: Is there any guidance on how to u...
# squarelibraries
s
Hey Folks 👋 Is there any guidance on how to use SQLDelight with background threads? If I try to wrap my transaction with
Copy code
withContext(Dispatchers.IO) {
     database.transactionWithResult { 
          ...
     }
}
Then I see
Copy code
java.lang.IllegalStateException: Transaction objects (`TransactionWithReturn` and `TransactionWithoutReturn`) must be used only within the transaction lambda scope.
p
Bitw you should limit the parallelism, or your will block threads due to the concurrency limit of the connection
s
due to the concurrency limit of the connection
What is the limit? Is it 1?
p
For Android it’s 1 thread for writing and 4 for reading
s
Thank you 👍
p
I didn’t find official documentations on the actual limit of WAL
And it’s probably device specific too for some vendors
@cb Where did you get the info on the SQLite connection limit from? https://github.com/chrisbanes/tivi/commit/9f990ec517685990d7b119d17788235cff3502c0
c
I don't remember tbh. I was probably just copying the Android configuration.
🙏 1
p
I read it in another slack space but also couldn’t find any sources on this