Skip to content

Commit

Permalink
fix: use total peers for pubsubTopic as out peers target (#1170)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyaprem authored Jul 30, 2024
1 parent a9be17f commit 76d8fd6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions waku/v2/peermanager/peer_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,10 @@ func (pm *PeerManager) ensureMinRelayConnsPerTopic() {
// peers. This will ensure that the peers returned by this function
// match those peers that are currently connected

curPeerLen := pm.checkAndUpdateTopicHealth(topicInst)
if curPeerLen < pm.OutPeersTarget {
meshPeerLen := pm.checkAndUpdateTopicHealth(topicInst)
topicPeers := pm.host.Peerstore().(wps.WakuPeerstore).PeersByPubSubTopic(topicStr)
curPeerLen := topicPeers.Len()
if meshPeerLen < waku_proto.GossipSubDMin || curPeerLen < pm.OutPeersTarget {
pm.logger.Debug("subscribed topic has not reached target peers, initiating more connections to maintain healthy mesh",
zap.String("pubSubTopic", topicStr), zap.Int("connectedPeerCount", curPeerLen),
zap.Int("targetPeers", pm.OutPeersTarget))
Expand Down

0 comments on commit 76d8fd6

Please sign in to comment.