Fix beginTransaction crash when continuing a transaction
Change-Id: Ied0911c1f310ed59a5bf18e423efa5c8b146c668
This commit is contained in:
parent
23f4f72ba3
commit
0eca1e03c0
|
@ -38,7 +38,9 @@ internal fun <T> CoroutineScope.asyncTransaction(realmConfiguration: RealmConfig
|
|||
suspend fun <T> awaitTransaction(config: RealmConfiguration, transaction: suspend (realm: Realm) -> T): T {
|
||||
return withContext(Realm.WRITE_EXECUTOR.asCoroutineDispatcher()) {
|
||||
Realm.getInstance(config).use { bgRealm ->
|
||||
bgRealm.beginTransaction()
|
||||
if (!bgRealm.isInTransaction) {
|
||||
bgRealm.beginTransaction()
|
||||
}
|
||||
val result: T
|
||||
try {
|
||||
val start = System.currentTimeMillis()
|
||||
|
|
Loading…
Reference in New Issue