Skip to content

Commit

Permalink
Safety logic check, don't try to stop a stopped server when suspendin…
Browse files Browse the repository at this point in the history
…g; closes #2318

Couldn't actually reproduce this, but a good sanity check I guess.
  • Loading branch information
DaneEveritt committed Sep 11, 2020
1 parent 0cd8dc2 commit c415abf
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions server/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

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)
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)
}
}
}

0 comments on commit c415abf

Please sign in to comment.