Disallow restart if one is already pending

This commit is contained in:
John Gross
2018-04-13 12:07:21 -07:00
committed by GitHub
parent c1e315fa40
commit b1edd62c0b

View File

@@ -152,6 +152,12 @@ namespace Torch.Commands
[Command("restart", "Restarts the server.")] [Command("restart", "Restarts the server.")]
public void Restart(int countdownSeconds = 10, bool save = true) public void Restart(int countdownSeconds = 10, bool save = true)
{ {
if (_restartPending)
{
Context.Respond("A restart is already pending.").
return;
}
_restartPending = true; _restartPending = true;
Task.Run(() => Task.Run(() =>
{ {
@@ -267,4 +273,4 @@ namespace Torch.Commands
}, this, TaskContinuationOptions.RunContinuationsAsynchronously); }, this, TaskContinuationOptions.RunContinuationsAsynchronously);
} }
} }
} }