Handles SIGTERM signal; resolves #827

This commit is contained in:
Yuce Tekol 2017-09-14 11:17:28 +03:00
parent 731dac2798
commit 79cea495d7
No known key found for this signature in database
GPG key ID: CB59E46D2FB90573

View file

@ -21,6 +21,7 @@ import (
"os"
"os/signal"
"runtime/pprof"
"syscall"
"time"
"github.com/spf13/cobra"
@ -76,7 +77,7 @@ on the configured port.`,
// First SIGKILL causes server to shut down gracefully.
c := make(chan os.Signal, 2)
signal.Notify(c, os.Interrupt)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
select {
case sig := <-c:
logger.Printf("Received %s; gracefully shutting down...\n", sig.String())