enhancement: UpdateTask when Task is waiting for ShutdownDelay (#14775)
Signed-off-by: Hemanth Krishna <hkpdev008@gmail.com>
This commit is contained in:
parent
8ae13208c9
commit
e516fc266f
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:improvement
|
||||||
|
client: Added a TaskEvent when task shutdown is waiting on shutdown_delay
|
||||||
|
```
|
|
@ -982,6 +982,10 @@ func (tr *TaskRunner) handleKill(resultCh <-chan *drivers.ExitResult) *drivers.E
|
||||||
if delay := tr.Task().ShutdownDelay; delay != 0 {
|
if delay := tr.Task().ShutdownDelay; delay != 0 {
|
||||||
tr.logger.Debug("waiting before killing task", "shutdown_delay", delay)
|
tr.logger.Debug("waiting before killing task", "shutdown_delay", delay)
|
||||||
|
|
||||||
|
ev := structs.NewTaskEvent(structs.TaskWaitingShuttingDownDelay).
|
||||||
|
SetDisplayMessage(fmt.Sprintf("Waiting for shutdown_delay of %s before killing the task.", delay))
|
||||||
|
tr.UpdateState(structs.TaskStatePending, ev)
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case result := <-resultCh:
|
case result := <-resultCh:
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -8159,6 +8159,10 @@ const (
|
||||||
|
|
||||||
// TaskClientReconnected indicates that the client running the task disconnected.
|
// TaskClientReconnected indicates that the client running the task disconnected.
|
||||||
TaskClientReconnected = "Reconnected"
|
TaskClientReconnected = "Reconnected"
|
||||||
|
|
||||||
|
// TaskWaitingShuttingDownDelay indicates that the task is waiting for
|
||||||
|
// shutdown delay before being TaskKilled
|
||||||
|
TaskWaitingShuttingDownDelay = "Waiting for shutdown delay"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TaskEvent is an event that effects the state of a task and contains meta-data
|
// TaskEvent is an event that effects the state of a task and contains meta-data
|
||||||
|
|
Loading…
Reference in New Issue