diff --git a/client/alloc_runner.go b/client/alloc_runner.go index 6f0db3db5..aa7cf79e5 100644 --- a/client/alloc_runner.go +++ b/client/alloc_runner.go @@ -279,9 +279,6 @@ func (r *AllocRunner) setTaskStatus(taskName, status, desc string) { Description: desc, } r.taskStatusLock.Unlock() - if tr, ok := r.tasks[taskName]; ok { - r.saveTaskRunnerState(tr) - } select { case r.dirtyCh <- struct{}{}: default: diff --git a/client/task_runner.go b/client/task_runner.go index deaae5cae..c8a5a390a 100644 --- a/client/task_runner.go +++ b/client/task_runner.go @@ -134,6 +134,9 @@ func (r *TaskRunner) DestroyState() error { // setStatus is used to update the status of the task runner func (r *TaskRunner) setStatus(status, desc string) { + if err := r.SaveState(); err != nil { + r.logger.Printf("[ERR] client: failed to save state of Task Runner: %v", r.task.Name) + } r.updater(r.task.Name, status, desc) }