Waits 500ms before restarting all connections.

This commit is contained in:
Vitor Pamplona
2024-05-30 17:11:11 -04:00
parent 9d190f93bb
commit 071da53a6a

View File

@@ -58,6 +58,7 @@ import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@Stable @Stable
@@ -112,7 +113,8 @@ class ServiceManager {
collectorJob = null collectorJob = null
collectorJob = collectorJob =
scope.launch { scope.launch {
myAccount.connectToRelaysFlow.collect { myAccount.connectToRelaysFlow.collectLatest {
delay(500)
if (isStarted) { if (isStarted) {
Client.reconnect(it, onlyIfChanged = true) Client.reconnect(it, onlyIfChanged = true)
} }