Skip to content

Commit 7ef1543

Browse files
author
ffffwh
committed
fix incorrect dtle node info #1037
and compare api host with ApiAddr instead of NomadAddr to avoid extra forwarding.
1 parent 297372e commit 7ef1543

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

api/handler/v2/job.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,8 +1123,10 @@ func buildJobDetailResp(nomadJob nomadApi.Job, nomadAllocations []nomadApi.Alloc
11231123
taskType := common.TaskTypeFromString(t.Name)
11241124
switch taskType {
11251125
case common.TaskTypeSrc:
1126-
srcTaskDetail = buildSrcTaskDetail(t.Name, internalTaskConfig, taskGroupToNomadAlloc[*tg.Name])
1127-
destTaskDetail = buildMysqlDestTaskDetail(t.Name, internalTaskConfig, taskGroupToNomadAlloc[*tg.Name])
1126+
srcTaskDetail = buildSrcTaskDetail(
1127+
common.TaskTypeSrc, internalTaskConfig, taskGroupToNomadAlloc[common.TaskTypeSrc])
1128+
destTaskDetail = buildMysqlDestTaskDetail(
1129+
common.TaskTypeDest, internalTaskConfig, taskGroupToNomadAlloc[common.TaskTypeDest])
11281130
break
11291131
case common.TaskTypeDest:
11301132
break

api/handler/v2/monitor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ func GetTaskProgressV2(c echo.Context) error {
6767
return c.JSON(http.StatusInternalServerError, models.BuildBaseResp(fmt.Errorf("get target host failed: %v", err)))
6868
}
6969
logger.Info("got target host", "targetHost", targetHost)
70-
selfNomadHost, _, err := net.SplitHostPort(handler.NomadHost)
71-
if nil != err {
70+
selfNomadHost, _, err := net.SplitHostPort(handler.ApiAddr)
71+
if err != nil {
7272
return c.JSON(http.StatusInternalServerError, models.BuildBaseResp(fmt.Errorf("get self nomad host failed: %v", err)))
7373
}
7474

0 commit comments

Comments
 (0)