also handle sigterm

This commit is contained in:
Ted Unangst 2019-11-11 00:00:05 -05:00
parent f72d1a6397
commit 615b5367d8
1 changed files with 2 additions and 0 deletions

2
web.go
View File

@ -31,6 +31,7 @@ import (
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
"syscall"
"time" "time"
"github.com/gorilla/mux" "github.com/gorilla/mux"
@ -2054,6 +2055,7 @@ var readyalready = make(chan bool)
func enditall() { func enditall() {
sig := make(chan os.Signal) sig := make(chan os.Signal)
signal.Notify(sig, os.Interrupt) signal.Notify(sig, os.Interrupt)
signal.Notify(sig, syscall.SIGTERM)
<-sig <-sig
count := 0 count := 0
log.Printf("stopping...") log.Printf("stopping...")