fix(exit): exit with 0 on successful shutdown

This commit is contained in:
Quentin McGaw
2022-09-14 13:23:31 +00:00
parent 875690ab18
commit e5be20d719

View File

@@ -108,11 +108,15 @@ func main() {
const shutdownGracePeriod = 5 * time.Second
timer := time.NewTimer(shutdownGracePeriod)
select {
case <-errorCh:
case err := <-errorCh:
if !timer.Stop() {
<-timer.C
}
logger.Info("Shutdown successful")
if err == nil {
logger.Info("Shutdown successful")
os.Exit(0)
}
logger.Warnf("Shutdown not completed gracefully: %s", err)
case <-timer.C:
logger.Warn("Shutdown timed out")
case signal := <-signalCh: