client: remove shortcircuit preventing poststart hooks from running

This commit is contained in:
Michael Schurter 2020-08-11 09:47:44 -07:00
parent 04a135b57d
commit e1946b66ce
1 changed files with 13 additions and 16 deletions

View File

@ -63,8 +63,10 @@ func (c *taskHookCoordinator) setTasks(tasks []*structs.Task) {
} else {
c.prestartEphemeral[task.Name] = struct{}{}
}
case structs.TaskLifecycleHookPoststart:
// Poststart hooks don't need to be tracked.
default:
c.logger.Error("invalid lifecycle hook", "hook", task.Lifecycle.Hook)
c.logger.Error("invalid lifecycle hook", "task", task.Name, "hook", task.Lifecycle.Hook)
}
}
@ -99,11 +101,6 @@ func (c *taskHookCoordinator) startConditionForTask(task *structs.Task) <-chan s
// This is not thread safe! This must only be called from one thread per alloc runner.
func (c *taskHookCoordinator) taskStateUpdated(states map[string]*structs.TaskState) {
if c.mainTaskCtx.Err() != nil {
// nothing to do here
return
}
for task := range c.prestartSidecar {
st := states[task]
if st == nil || st.StartedAt.IsZero() {