File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed
krescent-exposed/src/main/kotlin/dev/helight/krescent/exposed Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change 11package dev.helight.krescent.exposed
22
3- import kotlinx.coroutines.Dispatchers
4- import kotlinx.coroutines.async
53import kotlinx.coroutines.coroutineScope
6- import kotlinx.coroutines.runBlocking
74import org.jetbrains.exposed.sql.Database
85import org.jetbrains.exposed.sql.Transaction
96import org.jetbrains.exposed.sql.transactions.TransactionManager
10- import org.jetbrains.exposed.sql.transactions.transaction
7+ import org.jetbrains.exposed.sql.transactions.experimental.newSuspendedTransaction
118
129internal suspend fun <T > jdbcSuspendTransaction (
1310 database : Database ,
@@ -19,11 +16,7 @@ internal suspend fun <T> jdbcSuspendTransaction(
1916 ?.takeIf { it.db == database }
2017 ?.let { return @coroutineScope statement.invoke(it) }
2118
22- async(Dispatchers .IO ) {
23- transaction(database) {
24- runBlocking {
25- statement.invoke(this @transaction)
26- }
27- }
28- }.await()
19+ return @coroutineScope newSuspendedTransaction(db = database) {
20+ statement.invoke(this @newSuspendedTransaction)
21+ }
2922 }
You can’t perform that action at this time.
0 commit comments