Gracefully stops on SIGTERM
This commit is contained in:
parent
4ab5356ff9
commit
9ab7cab19e
|
@ -223,7 +223,7 @@ func makeShutdownCh() <-chan struct{} {
|
|||
resultCh := make(chan struct{})
|
||||
|
||||
signalCh := make(chan os.Signal, 4)
|
||||
signal.Notify(signalCh, os.Interrupt)
|
||||
signal.Notify(signalCh, interruptSignals...)
|
||||
go func() {
|
||||
for {
|
||||
<-signalCh
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
// +build !windows
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var interruptSignals []os.Signal = []os.Signal{os.Interrupt, syscall.SIGTERM}
|
|
@ -0,0 +1,9 @@
|
|||
// +build windows
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
var interruptSignals []os.Signal = []os.Signal{os.Interrupt}
|
Loading…
Reference in New Issue