From d73c2f3c8d0e966555b0ce80716fe8cb970a2834 Mon Sep 17 00:00:00 2001 From: Danielle Tomlinson Date: Tue, 20 Nov 2018 21:52:23 +0100 Subject: [PATCH] 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. --- client/allocrunner/taskrunner/task_runner.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/allocrunner/taskrunner/task_runner.go b/client/allocrunner/taskrunner/task_runner.go index a801b15fa..25a06bddd 100644 --- a/client/allocrunner/taskrunner/task_runner.go +++ b/client/allocrunner/taskrunner/task_runner.go @@ -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