Skip to content

Commit

Permalink
fix(exit): exit with 0 on successful shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Sep 14, 2022
1 parent 875690a commit e5be20d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/gluetun/main.go
Expand Up @@ -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:
Expand Down

0 comments on commit e5be20d

Please sign in to comment.