Commit 80fdafa1 authored by vicotor's avatar vicotor

fix bug

parent f22710d6
...@@ -170,12 +170,15 @@ func (wm *WorkerManager) doCallback(hook string, response *odysseus.TaskResponse ...@@ -170,12 +170,15 @@ func (wm *WorkerManager) doCallback(hook string, response *odysseus.TaskResponse
func (wm *WorkerManager) manageWorker(worker *Worker) error { func (wm *WorkerManager) manageWorker(worker *Worker) error {
log.WithField("worker", worker.uuid).Info("start manage worker") log.WithField("worker", worker.uuid).Info("start manage worker")
initialInterval := time.Second * 4
tickerConf := config.GetConfig().Tickers tickerConf := config.GetConfig().Tickers
initialHeartBeatInterval := time.Second * 1
initialInterval := initialHeartBeatInterval * 2
heartBeatDuration := time.Second * time.Duration(tickerConf.HeartBeat) heartBeatDuration := time.Second * time.Duration(tickerConf.HeartBeat)
workerCheckDuration := heartBeatDuration * 3 workerCheckDuration := heartBeatDuration * 3
heartBeatTicker := time.NewTicker(heartBeatDuration) heartBeatTicker := time.NewTicker(initialHeartBeatInterval)
defer heartBeatTicker.Stop() defer heartBeatTicker.Stop()
workerCheckTicker := time.NewTicker(workerCheckDuration) workerCheckTicker := time.NewTicker(workerCheckDuration)
...@@ -236,6 +239,7 @@ func (wm *WorkerManager) manageWorker(worker *Worker) error { ...@@ -236,6 +239,7 @@ func (wm *WorkerManager) manageWorker(worker *Worker) error {
hb.HeartbeatRequest = &omanager.HeartbeatRequest{ hb.HeartbeatRequest = &omanager.HeartbeatRequest{
Timestamp: uint64(time.Now().Unix()), Timestamp: uint64(time.Now().Unix()),
} }
heartBeatTicker.Reset(heartBeatDuration)
msg.Message = hb msg.Message = hb
callback = func(err error) bool { callback = func(err error) bool {
log.WithField("worker", worker.uuid).Info("send hear beat to worker") log.WithField("worker", worker.uuid).Info("send hear beat to worker")
......
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