Require a lock on the restart process to avoid double restarts causing unexpected behavior

This commit is contained in:
Dane Everitt
2020-07-18 16:46:41 -07:00
parent 6de18f09e5
commit a00288aa64
4 changed files with 92 additions and 11 deletions

View File

@@ -31,6 +31,13 @@ type Environment interface {
// not be returned.
Stop() error
// Restart a server instance. If already stopped the process will be started. This function
// will return an error if the server is already performing a restart process as to avoid
// unnecessary double/triple/quad looping issues if multiple people press restart or spam the
// button to restart.
Restart() error
IsRestarting() bool
// Waits for a server instance to stop gracefully. If the server is still detected
// as running after seconds, an error will be returned, or the server will be terminated
// depending on the value of the second argument.