Commit f3447317 authored by vicotor's avatar vicotor

update worker registry

parent 368de5cf
...@@ -37,14 +37,22 @@ func (w workerRegistry) DetailInfo() (json.RawMessage, error) { ...@@ -37,14 +37,22 @@ func (w workerRegistry) DetailInfo() (json.RawMessage, error) {
return nil, fmt.Errorf("worker address is empty") return nil, fmt.Errorf("worker address is empty")
} }
info := query.WorkerInfo{} info := query.WorkerInfo{
ActiveNM: make([]string, 0),
}
if w.worker.info.nodeInfo != nil { if w.worker.info.nodeInfo != nil {
info.BenefitAddress = w.worker.info.nodeInfo.BenefitAddress info.BenefitAddress = w.worker.info.nodeInfo.BenefitAddress
info.IP = w.worker.info.nodeInfo.DeviceIp info.IP = w.worker.info.nodeInfo.DeviceIp
} }
info.ActiveNM, _ = w.wm.WorkerNmList(w.worker) nmList, _ := w.wm.WorkerNmList(w.worker)
info.HearBeat = w.wm.GetHeartBeat(w.worker.uuid) for _, nm := range nmList {
endpoint, _ := w.wm.parseWorkerNmValue(nm)
if endpoint != "" {
info.ActiveNM = append(info.ActiveNM, endpoint)
}
}
info.HearBeat = w.wm.GetHeartBeat(w.worker.uuid) * 1000 // to ms
info.MinerAddress = w.worker.workerAddr info.MinerAddress = w.worker.workerAddr
info.Nonce = int64(w.worker.nonce) info.Nonce = int64(w.worker.nonce)
return json.Marshal(info) return json.Marshal(info)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment