Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing configuring the clients MaxConnsPerHost #7

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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