diff --git a/domains/olm/src/main/kotlin/app/dapk/st/olm/OlmWrapper.kt b/domains/olm/src/main/kotlin/app/dapk/st/olm/OlmWrapper.kt index 6707492..9f9826b 100644 --- a/domains/olm/src/main/kotlin/app/dapk/st/olm/OlmWrapper.kt +++ b/domains/olm/src/main/kotlin/app/dapk/st/olm/OlmWrapper.kt @@ -53,7 +53,6 @@ class OlmWrapper( true -> OlmInboundGroupSession.importSession(it.sessionKey) false -> OlmInboundGroupSession(it.sessionKey) } - logger.crypto("import megolm ${it.sessionKey}") olmStore.persist(it.sessionId, inBound) } } diff --git a/domains/store/src/main/kotlin/app/dapk/st/domain/OlmPersistence.kt b/domains/store/src/main/kotlin/app/dapk/st/domain/OlmPersistence.kt index 675e814..c01d535 100644 --- a/domains/store/src/main/kotlin/app/dapk/st/domain/OlmPersistence.kt +++ b/domains/store/src/main/kotlin/app/dapk/st/domain/OlmPersistence.kt @@ -11,9 +11,9 @@ import app.dapk.st.matrix.common.Curve25519 import app.dapk.st.matrix.common.RoomId import app.dapk.st.matrix.common.SessionId import com.squareup.sqldelight.TransactionWithoutReturn +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import kotlin.coroutines.resume -import kotlin.coroutines.suspendCoroutine class OlmPersistence( private val database: DapkDb, @@ -83,13 +83,9 @@ class OlmPersistence( } suspend fun startTransaction(action: suspend TransactionWithoutReturn.() -> Unit) { - val transaction = suspendCoroutine { - database.cryptoQueries.transaction(false) { - it.resume(this) - } - } - dispatchers.withIoContext { - action(transaction) + val scope = CoroutineScope(dispatchers.io) + database.cryptoQueries.transaction { + scope.launch { action() } } }