account for client restarts in task lifecycle hooks

This commit is contained in:
Jasmine Dahilig 2020-01-15 13:28:58 -08:00 committed by Mahmood Ali
parent 81d051d7e8
commit 0c44d0017d
1 changed files with 5 additions and 0 deletions

View File

@ -362,13 +362,18 @@ func (ar *allocRunner) Restore() error {
ar.state.DeploymentStatus = ds
ar.stateLock.Unlock()
states := make(map[string]*structs.TaskState)
// Restore task runners
for _, tr := range ar.tasks {
if err := tr.Restore(); err != nil {
return err
}
states[tr.Task().Name] = tr.TaskState()
}
ar.taskHookCoordinator.taskStateUpdated(states)
return nil
}