mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix(region): aliyun request retry
This commit is contained in:
@@ -161,6 +161,7 @@ func jsonRequest(client *sdk.Client, domain, apiVersion, apiName string, params
|
||||
"EOF",
|
||||
"i/o timeout",
|
||||
"TLS handshake timeout",
|
||||
"Client.Timeout exceeded while awaiting headers",
|
||||
"connection reset by peer",
|
||||
"server misbehaving",
|
||||
"SignatureNonceUsed",
|
||||
@@ -229,7 +230,7 @@ func (self *SAliyunClient) getDefaultClient() (*sdk.Client, error) {
|
||||
}
|
||||
|
||||
func (self *SAliyunClient) getSdkClient(regionId string) (*sdk.Client, error) {
|
||||
transport := httputils.GetTransport(true)
|
||||
transport := httputils.GetAdaptiveTransport(true)
|
||||
transport.Proxy = self.cpcfg.ProxyFunc
|
||||
client, err := sdk.NewClientWithOptions(
|
||||
regionId,
|
||||
|
||||
@@ -301,6 +301,10 @@ func GetTransport(insecure bool) *http.Transport {
|
||||
return getTransport(insecure, false)
|
||||
}
|
||||
|
||||
func GetAdaptiveTransport(insecure bool) *http.Transport {
|
||||
return getTransport(insecure, true)
|
||||
}
|
||||
|
||||
func adptiveDial(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
conn, err := net.DialTimeout(network, addr, 10*time.Second)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user