Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
formatted comments
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
  • Loading branch information
bacherfl authored and odubajDT committed May 13, 2022
1 parent d558dce commit 99f07be
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions approval-service/main.go
Expand Up @@ -143,21 +143,18 @@ func (l ApprovalService) RegistrationData() controlplane.RegistrationData {
}

func getGracefulContext() context.Context {

ch := make(chan os.Signal)
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
wg := &sync.WaitGroup{}
ctx, cancel := context.WithCancel(context.WithValue(context.Background(), gracefulShutdownKey, wg))
ctx = cloudevents.WithEncodingStructured(ctx)
go func() {
<-ch
logger.Info("Container termination triggered, starting graceful shutdown")
logger.Info("Cancelling context")
logger.Info("Container termination triggered, starting graceful shutdown and cancelling context")
cancel()
logger.Info("Waiting for event handlers to finish")
wg.Wait()
logger.Info("All handlers finished - ready to shut down")

}()
return ctx
}

0 comments on commit 99f07be

Please sign in to comment.