fix(exit): exit with 0 on successful shutdown
This commit is contained in:
@@ -108,11 +108,15 @@ func main() {
|
|||||||
const shutdownGracePeriod = 5 * time.Second
|
const shutdownGracePeriod = 5 * time.Second
|
||||||
timer := time.NewTimer(shutdownGracePeriod)
|
timer := time.NewTimer(shutdownGracePeriod)
|
||||||
select {
|
select {
|
||||||
case <-errorCh:
|
case err := <-errorCh:
|
||||||
if !timer.Stop() {
|
if !timer.Stop() {
|
||||||
<-timer.C
|
<-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:
|
case <-timer.C:
|
||||||
logger.Warn("Shutdown timed out")
|
logger.Warn("Shutdown timed out")
|
||||||
case signal := <-signalCh:
|
case signal := <-signalCh:
|
||||||
|
|||||||
Reference in New Issue
Block a user