Add default timeout to pkg/plugins/client

Signed-off-by: Chun Chen <ramichen@tencent.com>
Upstream-commit: 0699b00d26a60f4a8447572b34c4aad1ce73d2e1
Component: engine
This commit is contained in:
Chun Chen
2016-08-17 11:25:25 +08:00
parent ec2041215e
commit 9a4ddab230
2 changed files with 24 additions and 1 deletions

View File

@ -16,7 +16,8 @@ import (
)
const (
defaultTimeOut = 30
defaultTimeOut = 30
defaultHTTPTimeOut = 32 * time.Second
)
// NewClient creates a new plugin client (http).
@ -53,6 +54,7 @@ func NewClient(addr string, tlsConfig *tlsconfig.Options) (*Client, error) {
func NewClientWithTransport(tr transport.Transport) *Client {
return &Client{
http: &http.Client{
Timeout: defaultHTTPTimeOut,
Transport: tr,
},
requestFactory: tr,