mirror of https://github.com/vacp2p/nim-libp2p.git
small gossipsub metrics change
This commit is contained in:
parent
02ad017107
commit
34c2fbeb16
|
@ -302,16 +302,16 @@ proc rebalanceMesh*(g: GossipSub, topic: string, metrics: ptr MeshMetrics = nil)
|
|||
|
||||
trace "grafting", grafting = candidates.len
|
||||
|
||||
if candidates.len == 0:
|
||||
if not isNil(metrics):
|
||||
inc metrics[].noPeersTopics
|
||||
else:
|
||||
if candidates.len > 0:
|
||||
for peer in candidates:
|
||||
if g.mesh.addPeer(topic, peer):
|
||||
g.grafted(peer, topic)
|
||||
g.fanout.removePeer(topic, peer)
|
||||
grafts &= peer
|
||||
|
||||
if not isNil(metrics) and g.mesh.peers(topic) == 0:
|
||||
inc metrics[].noPeersTopics
|
||||
|
||||
else:
|
||||
var meshPeers = toSeq(g.mesh.getOrDefault(topic, initHashSet[PubSubPeer]()))
|
||||
meshPeers.keepIf do (x: PubSubPeer) -> bool: x.outbound
|
||||
|
|
Loading…
Reference in New Issue