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")
|
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)
|
ws := web.NewWebServer(g)
|
||||||
g.HealthyCallback = func() {
|
g.HealthyCallback = func() {
|
||||||
if !config.Get().Outposts.DisableEmbeddedOutpost {
|
if !config.Get().Outposts.DisableEmbeddedOutpost {
|
||||||
|
@ -70,8 +74,6 @@ func main() {
|
||||||
ws.Start()
|
ws.Start()
|
||||||
<-ex
|
<-ex
|
||||||
running = false
|
running = false
|
||||||
l.Info("shutting down gunicorn")
|
|
||||||
go g.Kill()
|
|
||||||
l.Info("shutting down webserver")
|
l.Info("shutting down webserver")
|
||||||
go ws.Shutdown()
|
go ws.Shutdown()
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ type GoUnicorn struct {
|
||||||
alive bool
|
alive bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGoUnicorn() *GoUnicorn {
|
func New() *GoUnicorn {
|
||||||
logger := log.WithField("logger", "authentik.router.unicorn")
|
logger := log.WithField("logger", "authentik.router.unicorn")
|
||||||
g := &GoUnicorn{
|
g := &GoUnicorn{
|
||||||
log: logger,
|
log: logger,
|
||||||
|
|
Reference in a new issue