Merge pull request #411 from hashicorp/b-save-tr-state

Saving state of the Task Runner while it's trying to update it
This commit is contained in:
Diptanu Choudhury 2015-11-12 15:59:48 -08:00
commit 88d64f5d9b
2 changed files with 3 additions and 3 deletions

View file

@ -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:

View file

@ -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)
}