提交 c95efefe authored 作者: mooncake9527's avatar mooncake9527

update

上级 8cf1f45f
...@@ -240,7 +240,7 @@ func (e *executor) idleBeat(writer http.ResponseWriter, request *http.Request) { ...@@ -240,7 +240,7 @@ func (e *executor) idleBeat(writer http.ResponseWriter, request *http.Request) {
err := json.Unmarshal(req, &param) err := json.Unmarshal(req, &param)
if err != nil { if err != nil {
_, _ = writer.Write(returnIdleBeat(FailureCode)) _, _ = writer.Write(returnIdleBeat(FailureCode))
e.log.Error("参数解析错误:" + string(req)) e.log.Error("parse params fail:" + string(req))
return return
} }
if e.runList.Exists(Int64ToStr(param.JobID)) { if e.runList.Exists(Int64ToStr(param.JobID)) {
...@@ -261,10 +261,10 @@ func (e *executor) registry() { ...@@ -261,10 +261,10 @@ func (e *executor) registry() {
} }
param, err := json.Marshal(req) param, err := json.Marshal(req)
if err != nil { if err != nil {
log.Fatal("执行器注册信息解析失败:" + err.Error()) log.Fatal("parse executor registry info fail:" + err.Error())
} }
if e.keepBeat(param) { if e.keepBeat(param) {
e.log.Info("connect registry success") e.log.Info("connect ​​scheduling center​​ success")
} }
t := time.NewTicker(time.Second * 20) t := time.NewTicker(time.Second * 20)
defer t.Stop() defer t.Stop()
...@@ -278,19 +278,19 @@ func (e *executor) keepBeat(param []byte) bool { ...@@ -278,19 +278,19 @@ func (e *executor) keepBeat(param []byte) bool {
ok := false ok := false
result, err := e.post("/api/registry", string(param)) result, err := e.post("/api/registry", string(param))
if err != nil { if err != nil {
e.log.Error("connect registry fail[1]:" + err.Error()) e.log.Error("executor connect ​​scheduling center​​ fail[1]:" + err.Error())
return ok return ok
} }
defer result.Body.Close() defer result.Body.Close()
body, err := io.ReadAll(result.Body) body, err := io.ReadAll(result.Body)
if err != nil { if err != nil {
e.log.Error("connect registry fail[2]:" + err.Error()) e.log.Error("executor connect ​​scheduling center​​ fail[2]:" + err.Error())
return ok return ok
} }
res := &res{} res := &res{}
_ = json.Unmarshal(body, &res) _ = json.Unmarshal(body, &res)
if res.Code != SuccessCode { if res.Code != SuccessCode {
e.log.Error("connect registry fail[3]:" + string(body)) e.log.Error("executor connect ​​scheduling center​​ fail[3]:" + string(body))
return ok return ok
} }
return true return true
...@@ -307,17 +307,17 @@ func (e *executor) registryRemove() { ...@@ -307,17 +307,17 @@ func (e *executor) registryRemove() {
} }
param, err := json.Marshal(req) param, err := json.Marshal(req)
if err != nil { if err != nil {
e.log.Error("执行器移除失败:" + err.Error()) e.log.Error("remove executor fail:" + err.Error())
return return
} }
res, err := e.post("/api/registryRemove", string(param)) res, err := e.post("/api/registryRemove", string(param))
if err != nil { if err != nil {
e.log.Error("执行器移除失败:" + err.Error()) e.log.Error("remove executor fail:" + err.Error())
return return
} }
defer res.Body.Close() defer res.Body.Close()
body, _ := io.ReadAll(res.Body) body, _ := io.ReadAll(res.Body)
e.log.Info("执行器移除成功:" + string(body)) e.log.Info("remove executor success:" + string(body))
} }
// 回调任务列表 // 回调任务列表
...@@ -330,7 +330,7 @@ func (e *executor) callback(task *Task, code int64, msg string) { ...@@ -330,7 +330,7 @@ func (e *executor) callback(task *Task, code int64, msg string) {
} }
defer res.Body.Close() defer res.Body.Close()
body, _ := io.ReadAll(res.Body) body, _ := io.ReadAll(res.Body)
e.log.Info("任务回调成功:" + string(body)) e.log.Info("job callback success:" + string(body))
} }
// post // post
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论