Commit 55f1bfe5 authored by vicotor's avatar vicotor

add retry for callback

parent ca6661f5
...@@ -216,11 +216,14 @@ func (wm *WorkerManager) doCallback(hook string, response *odysseus.TaskResponse ...@@ -216,11 +216,14 @@ func (wm *WorkerManager) doCallback(hook string, response *odysseus.TaskResponse
} else { } else {
log.WithField("task-id", response.TaskId).Debug("marshal task response") log.WithField("task-id", response.TaskId).Debug("marshal task response")
} }
err = utils.Post(hook, d) for i := 0; i < 5; i++ {
if err != nil { err = utils.Post(hook, d)
log.WithError(err).Error("post task result failed") if err != nil {
} else { log.WithField("try", i).WithError(err).Error("post task result failed")
log.WithField("task-id", response.TaskId).Debug("post task result") } else {
log.WithField("task-id", response.TaskId).Debug("post task result")
break
}
} }
} }
......
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