Skip to content

Commit

Permalink
Add support for SIGINT (facebookarchive#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
fiorix authored and daaku committed Sep 26, 2016
1 parent 2fe6ef9 commit 5729e48
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gracehttp/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ func (a *app) term(wg *sync.WaitGroup) {

func (a *app) signalHandler(wg *sync.WaitGroup) {
ch := make(chan os.Signal, 10)
signal.Notify(ch, syscall.SIGTERM, syscall.SIGUSR2)
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM, syscall.SIGUSR2)
for {
sig := <-ch
switch sig {
case syscall.SIGTERM:
// this ensures a subsequent TERM will trigger standard go behaviour of
case syscall.SIGINT, syscall.SIGTERM:
// this ensures a subsequent INT/TERM will trigger standard go behaviour of
// terminating.
signal.Stop(ch)
a.term(wg)
Expand Down

0 comments on commit 5729e48

Please sign in to comment.