Skip to content

Commit

Permalink
Fix custom timeouts
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis <[email protected]>
  • Loading branch information
alexellis committed Oct 26, 2017
1 parent 85612b4 commit 61e2959
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion proxy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func DeployFunction(fprocess string, gateway string, functionName string, image
reader := bytes.NewReader(reqBytes)
var request *http.Request

timeout := 120 * time.Second
timeout := 60 * time.Second
client := MakeHTTPClient(&timeout)

method := http.MethodPost
Expand Down
2 changes: 1 addition & 1 deletion proxy/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func ListFunctions(gateway string) ([]requests.Function, error) {

gateway = strings.TrimRight(gateway, "/")

timeout := 120 * time.Second
timeout := 60 * time.Second
client := MakeHTTPClient(&timeout)

getRequest, _ := http.NewRequest(http.MethodGet, gateway+"/system/functions", nil)
Expand Down
4 changes: 2 additions & 2 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (
func MakeHTTPClient(timeout *time.Duration) http.Client {
if timeout != nil {
return http.Client{
Timeout: 3 * time.Second,
Timeout: *timeout,
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 3 * time.Second,
Timeout: *timeout,
// KeepAlive: 0,
}).DialContext,
// MaxIdleConns: 1,
Expand Down

0 comments on commit 61e2959

Please sign in to comment.