Acquire exclusive lock when installing a server

Also allows aborting a server install mid-process when the server is deleted before the process finishes.
This commit is contained in:
Dane Everitt
2020-06-22 21:38:16 -07:00
parent 073247e4e1
commit 1f6789cba3
3 changed files with 100 additions and 15 deletions

View File

@@ -164,6 +164,11 @@ func deleteServer(c *gin.Context) {
// to start it while this process is running.
s.Suspended = true
// If the server is currently installing, abort it.
if s.IsInstalling() {
s.AbortInstallation()
}
// Delete the server's archive if it exists. We intentionally don't return
// here, if the archive fails to delete, the server can still be removed.
if err := s.Archiver.DeleteIfExists(); err != nil {