Skip to content

Commit

Permalink
fix: 避免同一时间long pull
Browse files Browse the repository at this point in the history
  • Loading branch information
zenghur committed Jul 24, 2019
1 parent 3355015 commit da81cf7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion diamond.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func (d *Diamond) Add(unit Unit) {
)
go func() {
for {
time.Sleep(time.Duration(randomIntInRange(20, 100)) * time.Millisecond)
newContentMD5, err := d.LongPull(unit, contentMD5)
d.checkErr(unit, err)
if contentMD5 == "" &&
Expand All @@ -128,7 +129,6 @@ func (d *Diamond) Add(unit Unit) {
if newContentMD5 != "" {
contentMD5 = newContentMD5
}
time.Sleep(time.Duration(randomIntInRange(20, 100)) * time.Millisecond)
}
}()

Expand Down

0 comments on commit da81cf7

Please sign in to comment.