cmd: Only stop admin server on signal if it exists (fix #3470)

This commit is contained in:
Matthew Holt 2020-06-03 07:31:31 -06:00
parent e18c373064
commit 83551edf3e
No known key found for this signature in database
GPG Key ID: 2A349DD577D586A5

View File

@ -69,12 +69,14 @@ func gracefulStop(sigName string) {
exitCode = ExitCodeFailedQuit
}
err = stopAdminServer(adminServer)
if err != nil {
Log().Error("stopping admin endpoint",
zap.String("signal", sigName),
zap.Error(err))
exitCode = ExitCodeFailedQuit
if adminServer != nil {
err = stopAdminServer(adminServer)
if err != nil {
Log().Error("stopping admin endpoint",
zap.String("signal", sigName),
zap.Error(err))
exitCode = ExitCodeFailedQuit
}
}
}