mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 00:07:50 +00:00
Set (short) timeout for http request polling
This commit is contained in:
parent
fe3d59ba7a
commit
6564fedbdb
@ -1091,12 +1091,14 @@ func testNotReachable(ip string, port int) {
|
|||||||
|
|
||||||
// Does an HTTP GET, but does not reuse TCP connections
|
// Does an HTTP GET, but does not reuse TCP connections
|
||||||
// This masks problems where the iptables rule has changed, but we don't see it
|
// This masks problems where the iptables rule has changed, but we don't see it
|
||||||
|
// This is intended for relatively quick requests (status checks), so we set a short (5 seconds) timeout
|
||||||
func httpGetNoConnectionPool(url string) (*http.Response, error) {
|
func httpGetNoConnectionPool(url string) (*http.Response, error) {
|
||||||
tr := &http.Transport{
|
tr := &http.Transport{
|
||||||
DisableKeepAlives: true,
|
DisableKeepAlives: true,
|
||||||
}
|
}
|
||||||
client := &http.Client{
|
client := &http.Client{
|
||||||
Transport: tr,
|
Transport: tr,
|
||||||
|
Timeout: 5 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
return client.Get(url)
|
return client.Get(url)
|
||||||
|
Loading…
Reference in New Issue
Block a user