[ARVADOS] created: 6e307516327390389ab265560cfb0693a4582210
git at public.curoverse.com
git at public.curoverse.com
Tue Dec 30 10:38:24 EST 2014
at 6e307516327390389ab265560cfb0693a4582210 (commit)
commit 6e307516327390389ab265560cfb0693a4582210
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Tue Dec 30 10:39:50 2014 -0500
4869: Enable TCP keepalive and adjust connection timeouts to Keep client.
diff --git a/sdk/go/keepclient/keepclient.go b/sdk/go/keepclient/keepclient.go
index df6fee1..dbc2466 100644
--- a/sdk/go/keepclient/keepclient.go
+++ b/sdk/go/keepclient/keepclient.go
@@ -10,6 +10,7 @@ import (
"io"
"io/ioutil"
"log"
+ "net"
"net/http"
"regexp"
"strings"
@@ -48,7 +49,22 @@ func MakeKeepClient(arv *arvadosclient.ArvadosClient) (kc KeepClient, err error)
Arvados: arv,
Want_replicas: 2,
Using_proxy: false,
- Client: &http.Client{Transport: &http.Transport{}}}
+ Client: &http.Client{
+ // The maximum duration of the connection, will be
+ // closed if exceeded.
+ Timeout: 5 * time.Minute,
+ Transport: &http.Transport{
+ Dial: (&net.Dialer{
+ // The maximum time to wait to set up
+ // the initial TCP connection.
+ Timeout: 60 * time.Second,
+
+ // The TCP keep alive heartbeat
+ // interval.
+ KeepAlive: 60 * time.Second,
+ }).Dial,
+ TLSHandshakeTimeout: 10 * time.Second,
+ }}}
err = (&kc).DiscoverKeepServers()
diff --git a/sdk/go/keepclient/support.go b/sdk/go/keepclient/support.go
index c03578c..a2787c5 100644
--- a/sdk/go/keepclient/support.go
+++ b/sdk/go/keepclient/support.go
@@ -9,6 +9,7 @@ import (
"io"
"io/ioutil"
"log"
+ "net"
"net/http"
"os"
"strings"
@@ -33,13 +34,29 @@ func (this *KeepClient) DiscoverKeepServers() error {
this.SetServiceRoots(sr)
this.Using_proxy = true
if this.Client.Timeout == 0 {
- this.Client.Timeout = 10 * time.Minute
+ // See MakeKeepClient for notes on meaning of timeouts.
+ this.Client.Timeout = 300 * time.Second
+ this.Client.Transport = &http.Transport{
+ Dial: (&net.Dialer{
+ Timeout: 30 * time.Second,
+ KeepAlive: 60 * time.Second,
+ }).Dial,
+ TLSHandshakeTimeout: 10 * time.Second,
+ }
}
return nil
}
if this.Client.Timeout == 0 {
- this.Client.Timeout = 15 * time.Second
+ // See MakeKeepClient for notes on meaning of timeouts.
+ this.Client.Timeout = 20 * time.Second
+ this.Client.Transport = &http.Transport{
+ Dial: (&net.Dialer{
+ Timeout: 2 * time.Second,
+ KeepAlive: 60 * time.Second,
+ }).Dial,
+ TLSHandshakeTimeout: 10 * time.Second,
+ }
}
type svcList struct {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list