mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-06-18 05:00:03 +02:00
src/main.go: in event loop, also listen for SIGTERM and gracefully shutdown the program.
This commit is contained in:
parent
b2c6589408
commit
2832b50fe7
1 changed files with 4 additions and 1 deletions
|
|
@ -78,7 +78,7 @@ func signalEventLoop() {
|
|||
sig_ch := make(chan os.Signal, 1)
|
||||
|
||||
// subscribe to SIGHUP signal.
|
||||
signal.Notify(sig_ch, syscall.SIGHUP, syscall.SIGINT)
|
||||
signal.Notify(sig_ch, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
||||
// Event loop
|
||||
func() {
|
||||
|
|
@ -91,6 +91,9 @@ func signalEventLoop() {
|
|||
case syscall.SIGINT :
|
||||
logger.Info("Interrupted")
|
||||
run = false
|
||||
case syscall.SIGTERM :
|
||||
logger.Info("Program was asked to terminate.", "signal", "SIGTERM")
|
||||
run = false
|
||||
// SIGHUP is sent when logfile is rotated.
|
||||
case syscall.SIGHUP :
|
||||
msg := "SIGHUP (Logfile was rotated): "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue