Slight improvements to server shutdown

This commit is contained in:
ceikry 2021-07-24 14:30:09 -05:00
parent 2e3370f5ce
commit 23a7d2a1b1
2 changed files with 3 additions and 2 deletions

View file

@ -35,6 +35,7 @@ public final class SystemTermination {
public void terminate() {
SystemLogger.logInfo("[SystemTerminator] Initializing termination sequence - do not shutdown!");
try {
Server.setRunning(false);
for(Player player : Repository.getPlayers()){
DMCHandler dmc = player.getAttribute("dmc",null);
if(dmc != null){

View file

@ -35,6 +35,7 @@ object Server {
var lastHeartbeat = System.currentTimeMillis()
@JvmStatic
var running = false
/**
@ -102,9 +103,8 @@ object Server {
GlobalScope.launch {
delay(20000)
while(running){
if(System.currentTimeMillis() - lastHeartbeat > 1800){
if(System.currentTimeMillis() - lastHeartbeat > 1800 && running){
SystemLogger.logErr("Triggering reboot due to heartbeat timeout")
running = false
exitProcess(0)
}
delay(625)