1
0
镜像自地址 https://github.com/tuna/tunasync.git 已同步 2025-12-06 06:26:46 +00:00

feat(worker): implemented extra_status_manager option to enable a worker reporting status to multi

这个提交包含在:
bigeagle
2016-12-06 23:59:15 +08:00
父节点 86153c59e3
当前提交 a0b8ef08ab
共有 2 个文件被更改,包括 13 次插入11 次删除

查看文件

@@ -405,12 +405,6 @@ func (w *Worker) registorWorker() {
}
func (w *Worker) updateStatus(job *mirrorJob, jobMsg jobMessage) {
url := fmt.Sprintf(
"%s/workers/%s/jobs/%s",
w.cfg.Manager.APIBase,
w.Name(),
jobMsg.name,
)
p := job.provider
smsg := MirrorStatus{
Name: jobMsg.name,
@@ -422,8 +416,15 @@ func (w *Worker) updateStatus(job *mirrorJob, jobMsg jobMessage) {
ErrorMsg: jobMsg.msg,
}
if _, err := PostJSON(url, smsg, w.httpClient); err != nil {
logger.Errorf("Failed to update mirror(%s) status: %s", jobMsg.name, err.Error())
apiBases := []string{w.cfg.Manager.APIBase}
apiBases = append(apiBases, w.cfg.Manager.ExtraStatusAPIs...)
for _, root := range apiBases {
url := fmt.Sprintf(
"%s/workers/%s/jobs/%s", root, w.Name(), jobMsg.name,
)
if _, err := PostJSON(url, smsg, w.httpClient); err != nil {
logger.Errorf("Failed to update mirror(%s) status: %s", jobMsg.name, err.Error())
}
}
}