From bf2b7dce1abffdc9cd3c2a00731fa5e15119133f Mon Sep 17 00:00:00 2001 From: Prem Chaitanya Prathi Date: Tue, 10 Sep 2024 18:12:08 +0530 Subject: [PATCH] feat: increase outbound q size for pubsub (#1217) --- waku/v2/protocol/peer_exchange/client.go | 2 -- waku/v2/protocol/relay/config.go | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/waku/v2/protocol/peer_exchange/client.go b/waku/v2/protocol/peer_exchange/client.go index 8075e2de..f901590d 100644 --- a/waku/v2/protocol/peer_exchange/client.go +++ b/waku/v2/protocol/peer_exchange/client.go @@ -123,13 +123,11 @@ func (wakuPX *WakuPeerExchange) handleResponse(ctx context.Context, response *pb } if params.clusterID != 0 { - wakuPX.log.Debug("clusterID is non zero, filtering by shard") rs, err := wenr.RelaySharding(enrRecord) if err != nil || rs == nil || !rs.Contains(uint16(params.clusterID), uint16(params.shard)) { wakuPX.log.Debug("peer doesn't matches filter", zap.Int("shard", params.shard)) continue } - wakuPX.log.Debug("peer matches filter", zap.Int("shard", params.shard)) } enodeRecord, err := enode.New(enode.ValidSchemes, enrRecord) diff --git a/waku/v2/protocol/relay/config.go b/waku/v2/protocol/relay/config.go index f0f41f80..bc1ea933 100644 --- a/waku/v2/protocol/relay/config.go +++ b/waku/v2/protocol/relay/config.go @@ -13,6 +13,10 @@ import ( var DefaultRelaySubscriptionBufferSize int = 1024 +// trying to match value here https://github.com/vacp2p/nim-libp2p/pull/1077 +// note that nim-libp2p has 2 peer queues 1 for priority and other non-priority, whereas go-libp2p seems to have single peer-queue +var DefaultPeerOutboundQSize int = 1024 + type RelaySubscribeParameters struct { dontConsume bool cacheSize uint @@ -109,6 +113,7 @@ func (w *WakuRelay) defaultPubsubOptions() []pubsub.Option { pubsub.WithSeenMessagesTTL(2 * time.Minute), pubsub.WithPeerScore(w.peerScoreParams, w.peerScoreThresholds), pubsub.WithPeerScoreInspect(w.peerScoreInspector, 6*time.Second), + pubsub.WithPeerOutboundQueueSize(DefaultPeerOutboundQSize), } }