subnet: Avoid general hard timeout for requests (#4478)
This commit is contained in:
+1
-1
@@ -175,7 +175,7 @@ func subnetAPIKeyAuthHeaders(apiKey string) subnetHeaders {
|
||||
}
|
||||
|
||||
func getSubnetClient() *http.Client {
|
||||
client := httpClient(10 * time.Second)
|
||||
client := httpClient(0)
|
||||
if globalSubnetProxyURL != nil {
|
||||
client.Transport.(*http.Transport).Proxy = http.ProxyURL(globalSubnetProxyURL)
|
||||
}
|
||||
|
||||
+9
-2
@@ -24,6 +24,7 @@ import (
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -425,10 +426,13 @@ func getClient(aliasURL string) *madmin.AdminClient {
|
||||
return client
|
||||
}
|
||||
|
||||
func httpClient(timeout time.Duration) *http.Client {
|
||||
func httpClient(reqTimeout time.Duration) *http.Client {
|
||||
return &http.Client{
|
||||
Timeout: timeout,
|
||||
Timeout: reqTimeout,
|
||||
Transport: &http.Transport{
|
||||
DialContext: (&net.Dialer{
|
||||
Timeout: 10 * time.Second,
|
||||
}).DialContext,
|
||||
Proxy: ieproxy.GetProxyFunc(),
|
||||
TLSClientConfig: &tls.Config{
|
||||
RootCAs: globalRootCAs,
|
||||
@@ -437,6 +441,9 @@ func httpClient(timeout time.Duration) *http.Client {
|
||||
// Can't use TLSv1.1 because of RC4 cipher usage
|
||||
MinVersion: tls.VersionTLS12,
|
||||
},
|
||||
IdleConnTimeout: 90 * time.Second,
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
ExpectContinueTimeout: 10 * time.Second,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user