|
|
@@ -2,6 +2,7 @@ package cloudbrain |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
"encoding/json" |
|
|
|
"fmt" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/models" |
|
|
@@ -143,14 +144,26 @@ sendjob: |
|
|
|
return nil, fmt.Errorf("resty GetImages: %v", err) |
|
|
|
} |
|
|
|
|
|
|
|
if getImagesResult.Code == "S401" && retry < 1 { |
|
|
|
var response models.CloudBrainResult |
|
|
|
err = json.Unmarshal(res.Body(), &response) |
|
|
|
if err != nil { |
|
|
|
log.Error("json.Unmarshal failed: %s", err.Error()) |
|
|
|
return &getImagesResult, fmt.Errorf("json.Unmarshal failed: %s", err.Error()) |
|
|
|
} |
|
|
|
|
|
|
|
if response.Code == "S401" && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = loginCloudbrain() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
if len(response.Code) != 0 { |
|
|
|
log.Error("getImagesResult failed(%s): %s", response.Code, response.Msg) |
|
|
|
return &getImagesResult, fmt.Errorf("getImagesResult failed(%s): %s", response.Code, response.Msg) |
|
|
|
} |
|
|
|
|
|
|
|
if getImagesResult.Code != Success { |
|
|
|
return &getImagesResult, fmt.Errorf("getImgesResult err: %s", res.String()) |
|
|
|
return &getImagesResult, fmt.Errorf("getImagesResult err: %s", res.String()) |
|
|
|
} |
|
|
|
|
|
|
|
return &getImagesResult, nil |
|
|
@@ -223,7 +236,7 @@ sendjob: |
|
|
|
func StopJob(jobID string) error { |
|
|
|
checkSetting() |
|
|
|
client := getRestyClient() |
|
|
|
var result models.StopJobResult |
|
|
|
var result models.CloudBrainResult |
|
|
|
|
|
|
|
retry := 0 |
|
|
|
|
|
|
|