Sync: add more safety to avoid some race conditions

This commit is contained in:
ganfra 2023-07-10 13:24:54 +02:00
parent 785c4a52f1
commit 65210b72f5

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)