Skip to content

Commit

Permalink
fix: long pull
Browse files Browse the repository at this point in the history
  • Loading branch information
zenghur committed Jun 27, 2019
1 parent 127b11b commit be29f44
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion diamond.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ func New(addr, tenant, accessKey, secretKey string) (*Diamond, error) {
secretKey: secretKey,
}
c, err := cast.New(
cast.WithRetry(2),
cast.WithHTTPClientTimeout(60*time.Second),
cast.WithExponentialBackoffDecorrelatedJitterStrategy(
time.Millisecond*200,
time.Millisecond*500,
),
cast.WithLogLevel(logrus.WarnLevel),
)
if err != nil {
Expand Down Expand Up @@ -109,7 +114,10 @@ func (d *Diamond) Add(unit Unit) {
newContentMD5 != "" && unit.FetchOnce {
return
}
contentMD5 = newContentMD5
// 防止网络较差情景下MD5被重置,重新请求配置,造成阿里云限流
if newContentMD5 != "" {
contentMD5 = newContentMD5
}
time.Sleep(time.Second)
}
}()
Expand Down

0 comments on commit be29f44

Please sign in to comment.