Commit 86bae577 authored by vicotor's avatar vicotor

fix bug

parent 3413f78e
......@@ -135,17 +135,20 @@ func (wm *WorkerManager) UpdateWorkerActive(worker *Worker) {
}
old := worker.latestNmValue
if err := wm.activeWorker(worker); err != nil {
if newNm, err := wm.activeWorker(worker); err != nil {
return
}
} else {
if old != newNm {
wm.rdb.SRem(context.Background(), workerStatusKey(worker), old)
}
}
}
func (wm *WorkerManager) activeWorker(worker *Worker) error {
func (wm *WorkerManager) activeWorker(worker *Worker) (string, error) {
split := "#"
v := fmt.Sprintf("%s%s%d", config.GetConfig().PublicEndpoint(), split, time.Now().Unix())
worker.latestNmValue = v
return wm.rdb.SAdd(context.Background(), workerStatusKey(worker), v).Err()
return v, wm.rdb.SAdd(context.Background(), workerStatusKey(worker), v).Err()
}
func (wm *WorkerManager) parseWorkerNmValue(nmValue string) (string, int64) {
......
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