Skip to content

Commit aec72cd

Browse files
committed
limit MaxConnsPerHost for http.Transport
1 parent 6b761a5 commit aec72cd

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

clickhouse_options.go

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ type Options struct {
149149
FreeBufOnConnRelease bool // drop preserved memory buffer after each query
150150
HttpHeaders map[string]string // set additional headers on HTTP requests
151151
HttpUrlPath string // set additional URL path for HTTP requests
152+
HttpMaxConnsPerHost int // MaxConnsPerHost for http.Transport
152153
BlockBufferSize uint8 // default 2 - can be overwritten on query
153154
MaxCompressionBuffer int // default 10485760 - measured in bytes i.e.
154155

conn_http.go

+1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ func dialHttp(ctx context.Context, addr string, num int, opt *Options) (*httpCon
212212
Timeout: opt.DialTimeout,
213213
}).DialContext,
214214
MaxIdleConns: 1,
215+
MaxConnsPerHost: opt.HttpMaxConnsPerHost,
215216
IdleConnTimeout: opt.ConnMaxLifetime,
216217
ResponseHeaderTimeout: opt.ReadTimeout,
217218
TLSClientConfig: opt.TLS,

0 commit comments

Comments
 (0)