rpc/client: add MaxConnsPerHost
option, fix #2149
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
296734d367
commit
9d34547118
1 changed files with 3 additions and 0 deletions
|
@ -50,6 +50,8 @@ type Options struct {
|
|||
CACert string
|
||||
DialTimeout time.Duration
|
||||
RequestTimeout time.Duration
|
||||
// Limit total number of connections per host. No limit by default.
|
||||
MaxConnsPerHost int
|
||||
}
|
||||
|
||||
// cache stores cache values for the RPC client methods.
|
||||
|
@ -86,6 +88,7 @@ func New(ctx context.Context, endpoint string, opts Options) (*Client, error) {
|
|||
DialContext: (&net.Dialer{
|
||||
Timeout: opts.DialTimeout,
|
||||
}).DialContext,
|
||||
MaxConnsPerHost: opts.MaxConnsPerHost,
|
||||
},
|
||||
Timeout: opts.RequestTimeout,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue