Skip to content

Commit

Permalink
Do not fatal on happy exit
Browse files Browse the repository at this point in the history
Summary: When we exit normally, through expected signal handling, we should not be returning a non-zero status code. Move the logging to `Info` and place it ahead of the actual shutdown invocation.

Reviewed By: leoleovich

Differential Revision: D57128031

fbshipit-source-id: 7900c47ad21bca3e1ea50ba20cb53072e14ab0fb
  • Loading branch information
Matt Diffenderfer authored and facebook-github-bot committed May 8, 2024
1 parent fca655d commit a191e91
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dnsrocks/cmd/dnsrocks/dnsrocks.go
Expand Up @@ -277,12 +277,13 @@ Currently two types of trigger files are supported:

go srv.LogMapAge()
go srv.DumpBackendStats()

sig := make(chan os.Signal, 1)
signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM)
s := <-sig
srv.Shutdown()
glog.Infof("Signal (%v) received, stopping\n", s)

glog.Fatalf("Signal (%v) received, stopping\n", s)
srv.Shutdown()
}

func failOnErr(err error, msg string) {
Expand Down

0 comments on commit a191e91

Please sign in to comment.