small gossipsub metrics change

This commit is contained in:
Giovanni Petrantoni 2021-03-03 08:41:21 +00:00
parent 02ad017107
commit 34c2fbeb16
1 changed files with 4 additions and 4 deletions

View File

@ -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