Treat sigterm as a clean shutdown signal (#4277)
(cherry picked from commit 40fac0a9b4
)
This commit is contained in:
parent
8cdf39cf66
commit
46fa0d79e5
|
@ -147,11 +147,11 @@ func reloadLoop(
|
||||||
|
|
||||||
shutdown := make(chan struct{})
|
shutdown := make(chan struct{})
|
||||||
signals := make(chan os.Signal)
|
signals := make(chan os.Signal)
|
||||||
signal.Notify(signals, os.Interrupt, syscall.SIGHUP)
|
signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGTERM)
|
||||||
go func() {
|
go func() {
|
||||||
select {
|
select {
|
||||||
case sig := <-signals:
|
case sig := <-signals:
|
||||||
if sig == os.Interrupt {
|
if sig == os.Interrupt || sig == syscall.SIGTERM {
|
||||||
close(shutdown)
|
close(shutdown)
|
||||||
}
|
}
|
||||||
if sig == syscall.SIGHUP {
|
if sig == syscall.SIGHUP {
|
||||||
|
|
Loading…
Reference in New Issue