From f45896d39558168418dcd902e7505d3567fd6924 Mon Sep 17 00:00:00 2001 From: Benson Wong Date: Mon, 19 May 2025 15:34:30 -0700 Subject: [PATCH] add guard to avoid unnecessary logic in Process.Shutdown --- proxy/process.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/proxy/process.go b/proxy/process.go index b6e4aba..e63d31a 100644 --- a/proxy/process.go +++ b/proxy/process.go @@ -389,8 +389,14 @@ func (p *Process) StopImmediately() { // is in the state of starting, it will cancel it and shut it down. Once a process is in // the StateShutdown state, it can not be started again. func (p *Process) Shutdown() { + if !isValidTransition(p.CurrentState(), StateStopping) { + return + } + p.shutdownCancel() p.stopCommand(p.gracefulStopTimeout) + + // just force it to this state since there is no recovery from shutdown p.state = StateShutdown }