From e8fa03c13786fb4eba00fbc3bc8597332960cbb2 Mon Sep 17 00:00:00 2001 From: Sebastian Widmer Date: Fri, 6 Oct 2023 16:10:49 +0200 Subject: [PATCH] Allowing configuring the clients `MaxConnsPerHost` --- config.go | 4 ++++ config.yml | 1 + processor.go | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config.go b/config.go index 5281761..2f16ef9 100644 --- a/config.go +++ b/config.go @@ -24,6 +24,7 @@ type config struct { Metadata bool LogResponseErrors bool `yaml:"log_response_errors"` MaxConnDuration time.Duration `yaml:"max_connection_duration"` + MaxConnsPerHost int `yaml:"max_connections_per_host"` Auth struct { Egress struct { @@ -62,6 +63,9 @@ func configParse(b []byte) (*config, error) { if cfg.Concurrency == 0 { cfg.Concurrency = 512 } + if cfg.MaxConnsPerHost == 0 { + cfg.MaxConnsPerHost = 64 + } if cfg.Tenant.Header == "" { cfg.Tenant.Header = "X-Scope-OrgID" diff --git a/config.yml b/config.yml index 5fb4631..f4c85cc 100644 --- a/config.yml +++ b/config.yml @@ -13,6 +13,7 @@ log_level: debug timeout: 10s timeout_shutdown: 0s concurrency: 10 +max_connections_per_host: 10 metadata: false log_response_errors: true diff --git a/processor.go b/processor.go index 70fe4c1..870813c 100644 --- a/processor.go +++ b/processor.go @@ -69,7 +69,7 @@ func newProcessor(c config, tenantLookup map[string]string) *processor { ReadTimeout: c.Timeout, WriteTimeout: c.Timeout, MaxConnWaitTimeout: 1 * time.Second, - MaxConnsPerHost: 64, + MaxConnsPerHost: c.MaxConnsPerHost, DialDualStack: c.EnableIPv6, MaxConnDuration: c.MaxConnDuration, }