parent
2fe6ef9ad6
commit
5729e48447
@ -98,12 +98,12 @@ func (a *app) term(wg *sync.WaitGroup) {
|
|||||||
|
|
||||||
func (a *app) signalHandler(wg *sync.WaitGroup) {
|
func (a *app) signalHandler(wg *sync.WaitGroup) {
|
||||||
ch := make(chan os.Signal, 10)
|
ch := make(chan os.Signal, 10)
|
||||||
signal.Notify(ch, syscall.SIGTERM, syscall.SIGUSR2)
|
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM, syscall.SIGUSR2)
|
||||||
for {
|
for {
|
||||||
sig := <-ch
|
sig := <-ch
|
||||||
switch sig {
|
switch sig {
|
||||||
case syscall.SIGTERM:
|
case syscall.SIGINT, syscall.SIGTERM:
|
||||||
// this ensures a subsequent TERM will trigger standard go behaviour of
|
// this ensures a subsequent INT/TERM will trigger standard go behaviour of
|
||||||
// terminating.
|
// terminating.
|
||||||
signal.Stop(ch)
|
signal.Stop(ch)
|
||||||
a.term(wg)
|
a.term(wg)
|
||||||
|
Loading…
Reference in New Issue
Block a user