Skip to content

Commit

Permalink
Merge pull request #5792 from vector-im/bugfix/eric/realm-write-async
Browse files Browse the repository at this point in the history
Replaces monarchy.doWithRealm with monarchy.awaitTransaction
  • Loading branch information
ouchadam authored Apr 20, 2022
2 parents 518a758 + 8eab24c commit 7c7822a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import org.matrix.android.sdk.internal.session.sync.model.accountdata.toMutable
import org.matrix.android.sdk.internal.session.user.UserEntityFactory
import org.matrix.android.sdk.internal.session.user.accountdata.DirectChatsHelper
import org.matrix.android.sdk.internal.session.user.accountdata.UpdateUserAccountDataTask
import org.matrix.android.sdk.internal.util.awaitTransaction
import javax.inject.Inject

internal class SyncResponsePostTreatmentAggregatorHandler @Inject constructor(
Expand Down Expand Up @@ -91,9 +92,9 @@ internal class SyncResponsePostTreatmentAggregatorHandler @Inject constructor(
}
}

private fun List<User>.saveLocally() {
private suspend fun List<User>.saveLocally() {
val userEntities = map { user -> UserEntityFactory.create(user) }
monarchy.doWithRealm {
monarchy.awaitTransaction {
it.insertOrUpdate(userEntities)
}
}
Expand Down

0 comments on commit 7c7822a

Please sign in to comment.