Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Combine the two signal goroutines
Browse files Browse the repository at this point in the history
  • Loading branch information
captncraig authored Jan 21, 2019
1 parent a7e4dfc commit 5e5f98b
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions cmd/helm-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ func main() {
logger = log.With(logger, "caller", log.DefaultCaller)
}

// error channel
errc := make(chan error)

// shutdown triggers
shutdown := make(chan struct{})
shutdownWg := &sync.WaitGroup{}
Expand All @@ -128,11 +125,7 @@ func main() {
go func() {
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
errc <- fmt.Errorf("%s", <-c)
}()

go func() {
logger.Log("exiting...", <-errc)
logger.Log("exiting...", fmt.Errorf("%s", <-c))
close(shutdown)
shutdownWg.Wait()
}()
Expand Down

0 comments on commit 5e5f98b

Please sign in to comment.