cmd: always stop gunicorn before exiting
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
77f6926a41
commit
26adf3f774
|
@ -58,7 +58,11 @@ func main() {
|
|||
|
||||
u, _ := url.Parse("http://localhost:8000")
|
||||
|
||||
g := gounicorn.NewGoUnicorn()
|
||||
g := gounicorn.New()
|
||||
defer func() {
|
||||
l.Info("shutting down gunicorn")
|
||||
g.Kill()
|
||||
}()
|
||||
ws := web.NewWebServer(g)
|
||||
g.HealthyCallback = func() {
|
||||
if !config.Get().Outposts.DisableEmbeddedOutpost {
|
||||
|
@ -70,8 +74,6 @@ func main() {
|
|||
ws.Start()
|
||||
<-ex
|
||||
running = false
|
||||
l.Info("shutting down gunicorn")
|
||||
go g.Kill()
|
||||
l.Info("shutting down webserver")
|
||||
go ws.Shutdown()
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ type GoUnicorn struct {
|
|||
alive bool
|
||||
}
|
||||
|
||||
func NewGoUnicorn() *GoUnicorn {
|
||||
func New() *GoUnicorn {
|
||||
logger := log.WithField("logger", "authentik.router.unicorn")
|
||||
g := &GoUnicorn{
|
||||
log: logger,
|
||||
|
|
Reference in New Issue