"fix: 为信号通道添加缓冲区防止阻塞"
This commit is contained in:
parent
bd1ddd8020
commit
ec1d21254d
|
@ -84,7 +84,7 @@ func (g *GoDaemon) Start() {
|
||||||
pid := os.Getpid()
|
pid := os.Getpid()
|
||||||
|
|
||||||
os.WriteFile(g.pidFile, []byte(strconv.Itoa(pid)), 0644)
|
os.WriteFile(g.pidFile, []byte(strconv.Itoa(pid)), 0644)
|
||||||
g.sigChan = make(chan os.Signal)
|
g.sigChan = make(chan os.Signal, 1)
|
||||||
|
|
||||||
signal.Notify(g.sigChan, syscall.SIGTERM, syscall.SIGHUP)
|
signal.Notify(g.sigChan, syscall.SIGTERM, syscall.SIGHUP)
|
||||||
go g.serveSignal()
|
go g.serveSignal()
|
||||||
|
|
Loading…
Reference in New Issue