|
@@ -4,7 +4,6 @@ import ( |
|
|
"encoding/json" |
|
|
"encoding/json" |
|
|
"errors" |
|
|
"errors" |
|
|
"fmt" |
|
|
"fmt" |
|
|
"math" |
|
|
|
|
|
"net/http" |
|
|
"net/http" |
|
|
"strconv" |
|
|
"strconv" |
|
|
"strings" |
|
|
"strings" |
|
@@ -359,10 +358,11 @@ func CommitAdminImage(params models.CommitImageParams) error { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func updateImageStatus(image models.Image, isSetCreatedUnix bool, createTime time.Time) { |
|
|
func updateImageStatus(image models.Image, isSetCreatedUnix bool, createTime time.Time) { |
|
|
attemps := 5 |
|
|
|
|
|
|
|
|
attemps := 60 |
|
|
commitSuccess := false |
|
|
commitSuccess := false |
|
|
time.Sleep(5 * time.Second) |
|
|
|
|
|
|
|
|
|
|
|
for i := 0; i < attemps; i++ { |
|
|
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)) |
|
|
log.Info("the " + strconv.Itoa(i) + " times query cloudbrain images.Imagetag:" + image.Tag + "isSetCreate:" + strconv.FormatBool(isSetCreatedUnix)) |
|
|
result, err := GetImagesPageable(1, pageSize, Custom, "") |
|
|
result, err := GetImagesPageable(1, pageSize, Custom, "") |
|
|
if err == nil && result.Code == "S000" { |
|
|
if err == nil && result.Code == "S000" { |
|
@@ -383,10 +383,6 @@ func updateImageStatus(image models.Image, isSetCreatedUnix bool, createTime tim |
|
|
if commitSuccess { |
|
|
if commitSuccess { |
|
|
break |
|
|
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 { |
|
|
if !commitSuccess { |
|
|