Removes lazy StateFlows due to inconsistent starting values.

This commit is contained in:
Vitor Pamplona
2025-07-14 11:19:12 -04:00
parent 909eb62db6
commit 597fec5c43
15 changed files with 89 additions and 55 deletions
@@ -63,7 +63,7 @@ open class Event(
try {
fromJson(json)
} catch (e: Exception) {
Log.e("Event", "Unable to parse event JSON: $json", e)
Log.w("Event", "Unable to parse event JSON: $json", e)
null
}
@@ -41,7 +41,6 @@ import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.sample
import kotlinx.coroutines.flow.stateIn
@@ -93,8 +92,6 @@ class NostrClient(
eventOutbox.relays,
) { reqs, counts, outbox ->
reqs + counts + outbox
}.onStart {
activeRequests.relays.value + activeCounts.relays.value + eventOutbox.relays.value
}.sample(300)
.onEach {
relayPool.updatePool(it)