Slight improvements to server shutdown
This commit is contained in:
@@ -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){
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user