From c415abf9716a43a16366b6ec7d34f9c27da6432b Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Thu, 10 Sep 2020 20:16:16 -0700 Subject: [PATCH] Safety logic check, don't try to stop a stopped server when suspending; closes #2318 Couldn't actually reproduce this, but a good sanity check I guess. --- server/update.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/server/update.go b/server/update.go index 18b2d93..f6261e6 100644 --- a/server/update.go +++ b/server/update.go @@ -143,12 +143,14 @@ func (s *Server) SyncWithEnvironment() { } else { // Checks if the server is now in a suspended state. If so and a server process is currently running it // will be gracefully stopped (and terminated if it refuses to stop). - s.Log().Info("server suspended with running process state, terminating now") + if s.GetState() != environment.ProcessOfflineState { + s.Log().Info("server suspended with running process state, terminating now") - go func(s *Server) { - if err := s.Environment.WaitForStop(60, true); err != nil { - s.Log().WithField("error", err).Warn("failed to terminate server environment after suspension") - } - }(s) + go func(s *Server) { + if err := s.Environment.WaitForStop(60, true); err != nil { + s.Log().WithField("error", err).Warn("failed to terminate server environment after suspension") + } + }(s) + } } }