Skip to content

Commit

Permalink
Allowing configuring the clients MaxConnsPerHost
Browse files Browse the repository at this point in the history
  • Loading branch information
bastjan committed Oct 6, 2023
1 parent 918ccae commit e8fa03c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down

0 comments on commit e8fa03c

Please sign in to comment.