From 7e996cf4a21cfabbcc26d04dba6ff3b0fbc2f45a Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Fri, 6 Nov 2015 15:26:01 -0800 Subject: [PATCH] Don't set the alloc status twice when not restarting --- client/task_runner.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/client/task_runner.go b/client/task_runner.go index a59c72fb8..b54b7604b 100644 --- a/client/task_runner.go +++ b/client/task_runner.go @@ -181,6 +181,7 @@ func (r *TaskRunner) Run() { } // Monitoring the Driver + defer r.DestroyState() err = r.monitorDriver(r.handle.WaitCh(), r.updateCh, r.destroyCh) for err != nil { r.logger.Printf("[ERR] client: failed to complete task '%s' for alloc '%s': %v", @@ -189,7 +190,7 @@ func (r *TaskRunner) Run() { if !shouldRestart { r.logger.Printf("[INFO] client: Not restarting task: %v for alloc: %v ", r.task.Name, r.allocID) r.setStatus(structs.AllocClientStatusDead, fmt.Sprintf("task failed with: %v", err)) - break + return } r.logger.Printf("[INFO] client: Restarting Task: %v", r.task.Name) @@ -215,8 +216,6 @@ func (r *TaskRunner) Run() { // Cleanup after ourselves r.logger.Printf("[INFO] client: completed task '%s' for alloc '%s'", r.task.Name, r.allocID) r.setStatus(structs.AllocClientStatusDead, "task completed") - - r.DestroyState() } // This functions listens to messages from the driver and blocks until the