fix: sync notification peer count with sidebar (#547)

This commit is contained in:
callebtc
2026-01-04 21:12:51 +07:00
committed by GitHub
parent fe5417bf97
commit 7ee61a0440
@@ -299,8 +299,7 @@ class PeerManager {
*/ */
fun isPeerActive(peerID: String): Boolean { fun isPeerActive(peerID: String): Boolean {
val info = peers[peerID] ?: return false val info = peers[peerID] ?: return false
val now = System.currentTimeMillis() return info.isConnected
return (now - info.lastSeen) <= stalePeerTimeoutMs && info.isConnected
} }
/** /**
@@ -328,8 +327,7 @@ class PeerManager {
* Get list of active peer IDs * Get list of active peer IDs
*/ */
fun getActivePeerIDs(): List<String> { fun getActivePeerIDs(): List<String> {
val now = System.currentTimeMillis() return peers.filterValues { it.isConnected }
return peers.filterValues { (now - it.lastSeen) <= stalePeerTimeoutMs && it.isConnected }
.keys .keys
.toList() .toList()
.sorted() .sorted()