Browse Source

Merge pull request '提交镜像超时时间改为20分钟' (#2132) from fix-1985 into V20220519

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/2132
Reviewed-by: lewis <747342561@qq.com>
pull/2138/head
lewis 3 years ago
parent
commit
71b3d28a15
1 changed files with 3 additions and 7 deletions
  1. +3
    -7
      modules/cloudbrain/resty.go

+ 3
- 7
modules/cloudbrain/resty.go View File

@@ -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 {


Loading…
Cancel
Save