diff options
author | Martin Polden <mpolden@mpolden.no> | 2023-03-20 15:00:42 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2023-03-23 12:13:46 +0100 |
commit | be8965384717caac4a13c741a2927ca13f827074 (patch) | |
tree | 4902462be93f662016395511bc8c3e3d1f072787 /client | |
parent | 4d201bee4a0d7b0d9425079eb3fe6c51e4cc1f44 (diff) |
Make connections per host configurable
Diffstat (limited to 'client')
-rw-r--r-- | client/go/internal/vespa/document/http.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/client/go/internal/vespa/document/http.go b/client/go/internal/vespa/document/http.go index 2f0d085085c..ad6765aecc8 100644 --- a/client/go/internal/vespa/document/http.go +++ b/client/go/internal/vespa/document/http.go @@ -26,10 +26,11 @@ type Client struct { // ClientOptions specifices the configuration options of a feed client. type ClientOptions struct { - BaseURL string - Timeout time.Duration - Route string - TraceLevel *int + MaxConnsPerHost int + BaseURL string + Timeout time.Duration + Route string + TraceLevel *int } type countingReader struct { @@ -44,12 +45,14 @@ func (r *countingReader) Read(p []byte) (int, error) { } func NewClient(options ClientOptions, httpClient util.HTTPClient) *Client { - return &Client{ + c := &Client{ options: options, httpClient: httpClient, stats: NewStats(), now: time.Now, } + httpClient.Transport().MaxConnsPerHost = options.MaxConnsPerHost + return c } func (c *Client) queryParams() url.Values { |