mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
discovery: add timeouts for discovery client
This commit is contained in:
parent
9f984ea6ae
commit
1381b44adf
@ -18,6 +18,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
@ -120,7 +121,15 @@ func newDiscovery(durl, dproxyurl string, id types.ID) (*discovery, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
cfg := client.Config{
|
cfg := client.Config{
|
||||||
Transport: &http.Transport{Proxy: pf},
|
Transport: &http.Transport{
|
||||||
|
Proxy: pf,
|
||||||
|
Dial: (&net.Dialer{
|
||||||
|
Timeout: 30 * time.Second,
|
||||||
|
KeepAlive: 30 * time.Second,
|
||||||
|
}).Dial,
|
||||||
|
TLSHandshakeTimeout: 10 * time.Second,
|
||||||
|
ResponseHeaderTimeout: 5 * time.Second,
|
||||||
|
},
|
||||||
Endpoints: []string{u.String()},
|
Endpoints: []string{u.String()},
|
||||||
}
|
}
|
||||||
c, err := client.New(cfg)
|
c, err := client.New(cfg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user