Sync: add more safety to avoid some race conditions

This commit is contained in:
ganfra
2023-07-10 13:24:54 +02:00
parent 870b5d3fe1
commit 0216a42531

View File

@@ -58,9 +58,7 @@ class RustSyncService(
.map(RoomListServiceState::toSyncState)
.onEach { state ->
Timber.v("Sync state=$state")
if (state == SyncState.InError || state == SyncState.Terminated) {
isSyncing.set(false)
}
isSyncing.set(state == SyncState.Syncing)
}
.distinctUntilChanged()
.stateIn(sessionCoroutineScope, SharingStarted.Eagerly, SyncState.Idle)