From 2be913b07736a6723019e11e9a31e2209881f241 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Thu, 20 May 2021 23:17:18 +0200 Subject: [PATCH] request queue size param --- cmd/reflector.go | 4 +++- peer/http3/server.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/reflector.go b/cmd/reflector.go index a642c7a..d2acfed 100644 --- a/cmd/reflector.go +++ b/cmd/reflector.go @@ -41,6 +41,7 @@ var ( reflectorCmdDiskCache string bufferReflectorCmdDiskCache string reflectorCmdMemCache int + requestQueueSize int ) func init() { @@ -58,6 +59,7 @@ func init() { cmd.Flags().IntVar(&http3PeerPort, "http3-peer-port", 5568, "The port reflector will distribute content from over HTTP3 protocol") cmd.Flags().IntVar(&receiverPort, "receiver-port", 5566, "The port reflector will receive content from") cmd.Flags().IntVar(&metricsPort, "metrics-port", 2112, "The port reflector will use for metrics") + cmd.Flags().IntVar(&requestQueueSize, "request-queue-size", 200, "How many concurrent requests should be submitted to upstream") cmd.Flags().BoolVar(&disableUploads, "disable-uploads", false, "Disable uploads to this reflector server") cmd.Flags().BoolVar(&disableBlocklist, "disable-blocklist", false, "Disable blocklist watching/updating") cmd.Flags().BoolVar(&useDB, "use-db", true, "whether to connect to the reflector db or not") @@ -96,7 +98,7 @@ func reflectorCmd(cmd *cobra.Command, args []string) { } defer peerServer.Shutdown() - http3PeerServer := http3.NewServer(outerStore) + http3PeerServer := http3.NewServer(outerStore, requestQueueSize) err = http3PeerServer.Start(":" + strconv.Itoa(http3PeerPort)) if err != nil { log.Fatal(err) diff --git a/peer/http3/server.go b/peer/http3/server.go index d81f0f8..3d49d17 100644 --- a/peer/http3/server.go +++ b/peer/http3/server.go @@ -33,7 +33,7 @@ type Server struct { } // NewServer returns an initialized Server pointer. -func NewServer(store store.BlobStore) *Server { +func NewServer(store store.BlobStore, requestQueueSize int) *Server { return &Server{ store: store, grp: stop.New(),