Web: Catch sigterm, as sent by Heroku

This commit is contained in:
Carl Johnson 2017-09-01 09:52:44 -04:00
parent ec2c965e05
commit 9049b78398
1 changed files with 2 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import (
"net/http"
"os"
"os/signal"
"syscall"
"time"
"github.com/carlmjohnson/heffalump/heff"
@ -33,7 +34,7 @@ func main() {
// subscribe to SIGINT signals
stopChan := make(chan os.Signal)
signal.Notify(stopChan, os.Interrupt)
signal.Notify(stopChan, syscall.SIGINT, syscall.SIGTERM)
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {