26 lines
599 B
Go
26 lines
599 B
Go
|
//go:build windows
|
||
|
// +build windows
|
||
|
|
||
|
package hpds_node
|
||
|
|
||
|
import (
|
||
|
"git.hpds.cc/Component/network/log"
|
||
|
)
|
||
|
|
||
|
// initialize when mq running as server. support inspection:
|
||
|
// - `kill -SIGTERM <pid>` graceful shutdown
|
||
|
func (z *messageQueue) init() {
|
||
|
go func() {
|
||
|
c := make(chan os.Signal, 1)
|
||
|
signal.Notify(c, syscall.SIGTERM, syscall.SIGINT)
|
||
|
log.Printf("%sListening SIGTERM/SIGINT...", mqLogPrefix)
|
||
|
for p1 := range c {
|
||
|
log.Printf("Received signal: %s", p1)
|
||
|
if p1 == syscall.SIGTERM || p1 == syscall.SIGINT {
|
||
|
log.Printf("graceful shutting down ... %s", p1)
|
||
|
os.Exit(0)
|
||
|
}
|
||
|
}
|
||
|
}()
|
||
|
}
|