Fix duplicate saving on quit
Slight refactor to split server stop and close functions Quit function explicitly sends SIGTERM SIGTERM doesn't trigger an os.Exit Bonus: Properly save the world on spawning the rover
This commit is contained in:
parent
141827fa57
commit
8586bdabd7
6 changed files with 28 additions and 13 deletions
|
@ -39,7 +39,7 @@ func TestServer_Run(t *testing.T) {
|
|||
|
||||
go server.Run()
|
||||
|
||||
if err := server.Close(); err != nil {
|
||||
if err := server.StopAndClose(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ func TestServer_RunPersistentData(t *testing.T) {
|
|||
|
||||
go server.Run()
|
||||
|
||||
if err := server.Close(); err != nil {
|
||||
if err := server.StopAndClose(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue