avoid creating prune message unless we're pruning (#487)
This commit is contained in:
parent
ea6988d380
commit
9e5ba64c48
|
@ -812,7 +812,7 @@ proc heartbeat(g: GossipSub) {.async.} =
|
|||
let gossipPeers = g.gossipsub.getOrDefault(t)
|
||||
# this will be changed by rebalance but does not matter
|
||||
totalMeshPeers += meshPeers.len
|
||||
totalGossipPeers += gossipPeers.len
|
||||
totalGossipPeers += g.gossipsub.peers(t)
|
||||
var prunes: seq[PubSubPeer]
|
||||
for peer in meshPeers:
|
||||
if peer.score < 0.0:
|
||||
|
@ -820,6 +820,7 @@ proc heartbeat(g: GossipSub) {.async.} =
|
|||
g.pruned(peer, t)
|
||||
g.mesh.removePeer(t, peer)
|
||||
prunes &= peer
|
||||
if prunes.len > 0:
|
||||
let prune = RPCMsg(control: some(ControlMessage(
|
||||
prune: @[ControlPrune(
|
||||
topicID: t,
|
||||
|
|
Loading…
Reference in New Issue