MCPcopy
hub / github.com/fagongzi/manba / waitStop

Function waitStop

cmd/api/api_server.go:92–111  ·  view source on GitHub ↗
(s *grpcx.GRPCServer)

Source from the content-addressed store, hash-verified

90}
91
92func waitStop(s *grpcx.GRPCServer) {
93 sc := make(chan os.Signal, 1)
94 signal.Notify(sc,
95 syscall.SIGHUP,
96 syscall.SIGINT,
97 syscall.SIGTERM,
98 syscall.SIGQUIT)
99
100 sig := <-sc
101 s.GracefulStop()
102 log.Infof("exit: signal=<%d>.", sig)
103 switch sig {
104 case syscall.SIGTERM:
105 log.Infof("exit: bye :-).")
106 os.Exit(0)
107 default:
108 log.Infof("exit: bye :-(.")
109 os.Exit(1)
110 }
111}

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected