Slowdown updates to random relay requests.

This commit is contained in:
Vitor Pamplona
2025-07-30 18:05:53 -04:00
parent 521a41d81b
commit 349dfe3d42
2 changed files with 3 additions and 2 deletions

View File

@@ -31,6 +31,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.debounce
import kotlinx.coroutines.launch
class AccountNotificationsEoseFromRandomRelaysManager(
@@ -61,7 +62,8 @@ class AccountNotificationsEoseFromRandomRelaysManager(
userJobMap[user] =
listOf(
key.account.scope.launch(Dispatchers.Default) {
key.account.followsPerRelay.collectLatest {
// no need to hurry here. we can wait the app stabilize
key.account.followsPerRelay.debounce(5000).collectLatest {
invalidateFilters()
}
},

View File

@@ -37,7 +37,6 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.NonCancellable.isActive
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flowOn