26 lines
614 B
Go
26 lines
614 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.Infof("%s Listening SIGTERM/SIGINT...", mqLogPrefix)
|
|
for p1 := range c {
|
|
log.Printf("Received signal: %s", p1)
|
|
if p1 == syscall.SIGTERM || p1 == syscall.SIGINT {
|
|
log.Infof("%s graceful shutting down ... %s", mqLogPrefix, p1)
|
|
os.Exit(0)
|
|
}
|
|
}
|
|
}()
|
|
}
|