Matteo Ciccozzi
06/21/2024, 11:51 PMsuspendedTransactionAsync
and suspendedTransaction
. As I understand suspendedTransaction
simply runs the blocking code on a separate thread whereas the former is actually non-blocking and we will await for the operation to complete.
If exposed uses JDBC API under the hood, I don't quite understands how this works in practice.minivac
06/26/2024, 11:39 AMsuspendedTransactionAsync
is a design fluke and you should not use it. If a library function is asynchronous it should be suspending, not return a deferred.
that is, suspended transaction is all you need.
suspendedTransaction { ... }
if you want true parallel logic you should tailor it to your actual needs, don't use suspendedTransactionAsync
coroutineScope {
async { suspendedTransaction { ... } }
async { suspendedTransaction { ... } }
}