From 1c59a00e26b7fb68568beae9ce4a28cb38635e54 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Tue, 8 Jun 2021 16:52:40 +0800 Subject: [PATCH] when job has been stopped in cloudbrain, dont failed --- modules/cloudbrain/resty.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/cloudbrain/resty.go b/modules/cloudbrain/resty.go index 3fb3abc52..ed6157776 100755 --- a/modules/cloudbrain/resty.go +++ b/modules/cloudbrain/resty.go @@ -1,6 +1,7 @@ package cloudbrain import ( + "code.gitea.io/gitea/modules/log" "fmt" "code.gitea.io/gitea/models" @@ -14,6 +15,10 @@ var ( TOKEN string ) +const ( + JobHasBeenStopped = "S410" +) + func getRestyClient() *resty.Client { if restyClient == nil { restyClient = resty.New() @@ -240,7 +245,11 @@ sendjob: } if result.Code != Success { - return fmt.Errorf("StopJob err: %s", res.String()) + if result.Code == JobHasBeenStopped { + log.Info("StopJob(%s) failed:%s", jobID, result.Msg) + } else { + return fmt.Errorf("StopJob err: %s", res.String()) + } } return nil