diff --git a/modules/graceful/manager.go b/modules/graceful/manager.go index 8c3b95c4aa..fd8c878349 100644 --- a/modules/graceful/manager.go +++ b/modules/graceful/manager.go @@ -192,6 +192,7 @@ func (g *Manager) RunAtHammer(hammer func()) { } func (g *Manager) doShutdown() { if !g.setStateTransition(stateRunning, stateShuttingDown) { + g.DoImmediateHammer() return } g.lock.Lock() diff --git a/modules/graceful/manager_unix.go b/modules/graceful/manager_unix.go index fcbb16a3bb..99e84d73e8 100644 --- a/modules/graceful/manager_unix.go +++ b/modules/graceful/manager_unix.go @@ -168,8 +168,12 @@ func (g *Manager) DoGracefulRestart() { if setting.GracefulRestartable { log.Info("PID: %d. Forking...", os.Getpid()) err := g.doFork() - if err != nil && err.Error() != "another process already forked. Ignoring this one" { - log.Error("Error whilst forking from PID: %d : %v", os.Getpid(), err) + if err != nil { + if err.Error() == "another process already forked. Ignoring this one" { + g.DoImmediateHammer() + } else { + log.Error("Error whilst forking from PID: %d : %v", os.Getpid(), err) + } } } else { log.Info("PID: %d. Not set restartable. Shutting down...", os.Getpid())