https://kotlinlang.org logo
v

Vinicius Araujo

09/30/2020, 1:19 AM
Good night! It may be a getting started coroutine question, but since its subject is strictly related to exposed, maybe someone can help me with an expecifc use case insight. So if I do it like this:
Copy code
fun addA() = transaction{A insert statement}
fun addB() = trabsaction{B insert statement}

suspend fun applyAandB() = coroutineScope {
    launch { addA() }
    launch { addB() }
}
would them execute asyncronously?
v

Vinicius Araujo

09/30/2020, 12:28 PM
Yes but the example they give there is asynchronous transaction inside a transaction block, my question is about separated transactions blocks being called asynchronously
t

tapac

09/30/2020, 1:13 PM
If your scope uses Dispatcher with multiple threads then transactions will be executed in parallel.
v

Vinicius Araujo

09/30/2020, 5:18 PM
thanks!