diff --git a/modules/cloudbrain/resty.go b/modules/cloudbrain/resty.go index b5b86f31f..e70dbdd2b 100755 --- a/modules/cloudbrain/resty.go +++ b/modules/cloudbrain/resty.go @@ -4,7 +4,6 @@ import ( "encoding/json" "errors" "fmt" - "math" "net/http" "strconv" "strings" @@ -359,10 +358,11 @@ func CommitAdminImage(params models.CommitImageParams) error { } func updateImageStatus(image models.Image, isSetCreatedUnix bool, createTime time.Time) { - attemps := 5 + attemps := 60 commitSuccess := false - time.Sleep(5 * time.Second) + for i := 0; i < attemps; i++ { + time.Sleep(20 * time.Second) log.Info("the " + strconv.Itoa(i) + " times query cloudbrain images.Imagetag:" + image.Tag + "isSetCreate:" + strconv.FormatBool(isSetCreatedUnix)) result, err := GetImagesPageable(1, pageSize, Custom, "") if err == nil && result.Code == "S000" { @@ -383,10 +383,6 @@ func updateImageStatus(image models.Image, isSetCreatedUnix bool, createTime tim if commitSuccess { break } - //第一次循环等待4秒,第二次等待4的2次方16秒,...,第5次。。。 ,总共大概是20多分钟内进行5次重试 - var sleepTime = time.Duration(int(math.Pow(4, (float64(i + 1))))) - - time.Sleep(sleepTime * time.Second) } if !commitSuccess {