mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 17:30:56 +00:00
Make parent process exit gracefully.
With beego.BConfig.Listen.Graceful enabled, when received SIGHUP, we'll fork a child process. But the parent process still have jobs to finish, So we can't kill the parent process directly.
This commit is contained in:
parent
d96289a81b
commit
1dd50fb65f
@ -65,7 +65,7 @@ func (srv *Server) ListenAndServe() (err error) {
|
|||||||
log.Println(err)
|
log.Println(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = process.Kill()
|
err = process.Signal(syscall.SIGTERM)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ func (srv *Server) ListenAndServeTLS(certFile, keyFile string) (err error) {
|
|||||||
log.Println(err)
|
log.Println(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = process.Kill()
|
err = process.Signal(syscall.SIGTERM)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user