perf: update rule data in default thread

This commit is contained in:
lisonge 2024-06-09 05:13:09 +08:00
parent 75797a89cc
commit 9f0f026459

View File

@ -15,6 +15,7 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.update
@ -292,7 +293,7 @@ val ruleSummaryFlow by lazy {
appIdToAllGroups = appAllGroups.mapValues { e -> e.value.toImmutableList() }
.toImmutableMap()
)
}.stateIn(appScope, SharingStarted.Eagerly, RuleSummary())
}.flowOn(Dispatchers.Default).stateIn(appScope, SharingStarted.Eagerly, RuleSummary())
}
private fun loadSubs(id: Long): RawSubscription {