Saving state of the Task Runner while it's trying to update it

This commit is contained in:
Diptanu Choudhury 2015-11-12 15:53:42 -08:00
parent d22a2fa813
commit 3b4cb6dbc9
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, Description: desc,
} }
r.taskStatusLock.Unlock() r.taskStatusLock.Unlock()
if tr, ok := r.tasks[taskName]; ok {
r.saveTaskRunnerState(tr)
}
select { select {
case r.dirtyCh <- struct{}{}: case r.dirtyCh <- struct{}{}:
default: default:

View File

@ -134,6 +134,9 @@ func (r *TaskRunner) DestroyState() error {
// setStatus is used to update the status of the task runner // setStatus is used to update the status of the task runner
func (r *TaskRunner) setStatus(status, desc string) { 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) r.updater(r.task.Name, status, desc)
} }