mirror of https://github.com/go-gitea/gitea.git
Immediately Hammer if second kill is sent (#18823)
Currently Gitea will wait for HammerTime or nice shutdown if kill -1 or kill -2 is sent. We should just immediately hammer if there is a second kill. Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
4b3ebda0e7
commit
83c9035971
|
@ -193,6 +193,7 @@ func (g *Manager) RunAtHammer(hammer func()) {
|
||||||
|
|
||||||
func (g *Manager) doShutdown() {
|
func (g *Manager) doShutdown() {
|
||||||
if !g.setStateTransition(stateRunning, stateShuttingDown) {
|
if !g.setStateTransition(stateRunning, stateShuttingDown) {
|
||||||
|
g.DoImmediateHammer()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
g.lock.Lock()
|
g.lock.Lock()
|
||||||
|
|
|
@ -168,9 +168,13 @@ func (g *Manager) DoGracefulRestart() {
|
||||||
if setting.GracefulRestartable {
|
if setting.GracefulRestartable {
|
||||||
log.Info("PID: %d. Forking...", os.Getpid())
|
log.Info("PID: %d. Forking...", os.Getpid())
|
||||||
err := g.doFork()
|
err := g.doFork()
|
||||||
if err != nil && err.Error() != "another process already forked. Ignoring this one" {
|
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)
|
log.Error("Error whilst forking from PID: %d : %v", os.Getpid(), err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Info("PID: %d. Not set restartable. Shutting down...", os.Getpid())
|
log.Info("PID: %d. Not set restartable. Shutting down...", os.Getpid())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue