Updated SIG* handling code in main().
This commit is contained in:
parent
3251d9e983
commit
62f6e3b976
@ -99,20 +99,17 @@ func main() {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
reloadSignal := make(chan os.Signal, 1)
|
sysSignal := make(chan os.Signal, 1)
|
||||||
signal.Notify(reloadSignal, syscall.SIGHUP)
|
signal.Notify(sysSignal, os.Interrupt, syscall.SIGINT, syscall.SIGTERM, syscall.SIGABRT, syscall.SIGSEGV, syscall.SIGHUP)
|
||||||
|
|
||||||
go func() {
|
for {
|
||||||
for {
|
switch <-sysSignal {
|
||||||
<-reloadSignal
|
case os.Interrupt, syscall.SIGINT, syscall.SIGTERM, syscall.SIGABRT, syscall.SIGSEGV:
|
||||||
|
return
|
||||||
|
case syscall.SIGHUP:
|
||||||
if err := plylst.Reload(); err != nil {
|
if err := plylst.Reload(); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}
|
||||||
|
|
||||||
doneSignal := make(chan os.Signal, 1)
|
|
||||||
signal.Notify(doneSignal, os.Interrupt, syscall.SIGINT, syscall.SIGTERM, syscall.SIGABRT, syscall.SIGSEGV)
|
|
||||||
|
|
||||||
<-doneSignal
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user