https://kotlinlang.org logo
#squarelibraries
Title
# squarelibraries
c

Colton Idle

03/05/2024, 3:35 AM
I have a method like this, but I can't run my onSuccess arg that's passed in, in the "afterCommit" block. Any way around that?
Copy code
suspend fun doTransaction(
  bufferedReader: BufferedReader,
  onSuccess: suspend () -> Unit
) = withContext(Dispatchers.IO) {
var currentLine: String? = null
try {
  myQueries.transaction {
    afterCommit {
      Sentry.captureMessage("Transaction completed with ${myQueries.getCount().executeAsOne()}")
      onSuccess()
    }
...
Now that I think about it. I wonder if my Sentry.captureMessage would actually get run on the main thread. since i guess its not being run on Dispatchers.IO. 🤔
2 Views