Environment exits if shutdown takes too long
This commit is contained in:
parent
0077a5d115
commit
bae737e6b8
13
phases.go
13
phases.go
@ -255,6 +255,19 @@ func (this *environment) phase70_5Trimming() bool {
|
||||
}
|
||||
|
||||
func (this *environment) phase80Shutdown() bool {
|
||||
ctx, done := context.WithTimeout(
|
||||
context.Background(),
|
||||
defaul(this.timing.shutdownTimeout.Load(), defaultShutdownTimeout))
|
||||
defer done()
|
||||
go func() {
|
||||
<- ctx.Done()
|
||||
if errors.Is(context.Cause(ctx), context.DeadlineExceeded) {
|
||||
log.Println("XXX (80) shutdown timeout expired, performing emergency halt")
|
||||
log.Printf("====== [%s] END =======", this.name)
|
||||
os.Exit(1)
|
||||
}
|
||||
}()
|
||||
|
||||
cause := context.Cause(this.ctx)
|
||||
if cause != nil {
|
||||
log.Println("XXX (80) shutting down because:", cause)
|
||||
|
Loading…
Reference in New Issue
Block a user