Refactor how to handle sigterm and nginx process goroutine (#4959)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-01-25 14:52:31 -03:00 committed by GitHub
parent 12aa72622a
commit 66ef05849f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View file

@ -125,23 +125,22 @@ func main() {
}
mc.Start()
ngx := controller.NewNGINXController(conf, mc)
go handleSigterm(ngx, func(code int) {
os.Exit(code)
})
mux := http.NewServeMux()
if conf.EnableProfiling {
go registerProfiler()
}
ngx := controller.NewNGINXController(conf, mc)
mux := http.NewServeMux()
registerHealthz(nginx.HealthPath, ngx, mux)
registerMetrics(reg, mux)
go startHTTPServer(conf.ListenPorts.Health, mux)
go ngx.Start()
ngx.Start()
handleSigterm(ngx, func(code int) {
os.Exit(code)
})
}
type exiter func(code int)