From a9a0912f96cf7d532660ce2acfcad2a8ce0b3abf Mon Sep 17 00:00:00 2001 From: tbjump Date: Tue, 22 Aug 2023 15:22:59 +0000 Subject: [PATCH] node/p2p: set WithValidateQueueSize 1024 --- node/pkg/p2p/p2p.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/node/pkg/p2p/p2p.go b/node/pkg/p2p/p2p.go index 1eaa2867c..d4f75e5bb 100644 --- a/node/pkg/p2p/p2p.go +++ b/node/pkg/p2p/p2p.go @@ -43,6 +43,9 @@ import ( const DefaultPort = 8999 +const P2P_VALIDATE_QUEUE_SIZE = 1024 +const P2P_SUBSCRIPTION_BUFFER_SIZE = 1024 + var ( p2pHeartbeatsSent = promauto.NewCounter( prometheus.CounterOpts{ @@ -276,7 +279,9 @@ func Run( topic := fmt.Sprintf("%s/%s", networkID, "broadcast") logger.Info("Subscribing pubsub topic", zap.String("topic", topic)) - ps, err := pubsub.NewGossipSub(ctx, h) + ps, err := pubsub.NewGossipSub(ctx, h, + pubsub.WithValidateQueueSize(P2P_VALIDATE_QUEUE_SIZE), + ) if err != nil { panic(err) } @@ -294,7 +299,7 @@ func Run( // Increase the buffer size to prevent failed delivery // to slower subscribers - sub, err := th.Subscribe(pubsub.WithBufferSize(1024)) + sub, err := th.Subscribe(pubsub.WithBufferSize(P2P_SUBSCRIPTION_BUFFER_SIZE)) if err != nil { return fmt.Errorf("failed to subscribe topic: %w", err) }