You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/11/14 22:18:46 UTC

[GitHub] dubee closed pull request #103: Allow NewClient to run concurrently

dubee closed pull request #103: Allow NewClient to run concurrently
URL: https://github.com/apache/incubator-openwhisk-client-go/pull/103
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/whisk/client.go b/whisk/client.go
index c710efde..67976510 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
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services