mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 02:15:43 +03:00
taskrunner: Return the restart delay correctly
We were incorrectly returning a 0 duration to the taskrunner when
determining when a task should restart. This would cause tasks to be
restarted immediately, ignoring the restart {} stanza in a users
configuration.
This commit causes us to return the restart duration to the task runner
so it may correctly delay further execution.
This commit is contained in:
@@ -457,7 +457,7 @@ func (tr *TaskRunner) shouldRestart() (bool, time.Duration) {
|
||||
case structs.TaskRestarting:
|
||||
tr.logger.Info("restarting task", "reason", reason, "delay", when)
|
||||
tr.UpdateState(structs.TaskStatePending, structs.NewTaskEvent(structs.TaskRestarting).SetRestartDelay(when).SetRestartReason(reason))
|
||||
return true, 0
|
||||
return true, when
|
||||
default:
|
||||
tr.logger.Error("restart tracker returned unknown state", "state", state)
|
||||
return true, when
|
||||
|
||||
Reference in New Issue
Block a user