github.com/qiniu/go-sdk/v7@v7.27.0/internal/clientv2/retry_config.go (about) 1 package clientv2 2 3 import ( 4 "net/http" 5 "time" 6 7 "github.com/qiniu/go-sdk/v7/storagev2/backoff" 8 "github.com/qiniu/go-sdk/v7/storagev2/retrier" 9 ) 10 11 type RetryConfig struct { 12 RetryMax int // 最大重试次数 13 RetryInterval func() time.Duration // 重试时间间隔 v1 14 Backoff backoff.Backoff // 重试时间间隔 v2,优先级高于 RetryInterval 15 ShouldRetry func(req *http.Request, resp *http.Response, err error) bool 16 Retrier retrier.Retrier // 重试器 17 } 18 19 func (c *RetryConfig) init() { 20 if c == nil { 21 return 22 } 23 24 if c.RetryMax < 0 { 25 c.RetryMax = 0 26 } 27 }