This is an automated email from the ASF dual-hosted git repository.
dubeejw pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/incubator-openwhisk-client-go.git
The following commit(s) were added to refs/heads/master by this push:
new 198447c Allow NewClient to run concurrently (#103)
198447c is described below
commit 198447c6c051488e648f5a799a32542e392f66aa
Author: Lionel Villard <[email protected]>
AuthorDate: Wed Nov 14 17:18:42 2018 -0500
Allow NewClient to run concurrently (#103)
---
whisk/client.go | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/whisk/client.go b/whisk/client.go
index c710efd..6797651 100644
--- a/whisk/client.go
+++ b/whisk/client.go
@@ -27,6 +27,7 @@ import (
"github.com/apache/incubator-openwhisk-client-go/wski18n"
"io"
"io/ioutil"
+ "net"
"net/http"
"net/url"
"reflect"
@@ -214,10 +215,19 @@ func (c *Client) LoadX509KeyPair() error {
}
// Use the defaultTransport as the transport basis to maintain proxy
support
- // Make a copy of the defaultTransport so that the original
defaultTransport is left alone
- defaultTransportCopy := *(http.DefaultTransport.(*http.Transport))
- defaultTransportCopy.TLSClientConfig = tlsConfig
- c.client.Transport = &defaultTransportCopy
+ c.client.Transport = &http.Transport{
+ Proxy: http.ProxyFromEnvironment,
+ DialContext: (&net.Dialer{
+ Timeout: 30 * time.Second,
+ KeepAlive: 30 * time.Second,
+ DualStack: true,
+ }).DialContext,
+ MaxIdleConns: 100,
+ IdleConnTimeout: 90 * time.Second,
+ TLSHandshakeTimeout: 10 * time.Second,
+ ExpectContinueTimeout: 1 * time.Second,
+ TLSClientConfig: tlsConfig,
+ }
return nil
}