Add some extra debug and redundancy

This commit is contained in:
zontreck 2024-05-25 13:42:30 -07:00
parent 9d584d151d
commit 360ae26044

View file

@ -226,6 +226,7 @@ class StateMachine {
// Send the alert message
SessionData.CURRENT_INTERVAL = current;
if (current.type == WarnType.Intrusive) {
print("Sending alert '${current.warning}'");
settings.sendRconCommand("broadcast ${current.warning}");
}
}
@ -239,9 +240,10 @@ class StateMachine {
// Check mod updates
if (SessionData.shouldCheckModUpdates()) {
print("Scheduling mod update checker...");
SessionData.resetModUpdateChecker();
Timer.periodic(Duration(seconds: 10), (timer) async {
timer.cancel();
SessionData.resetModUpdateChecker();
await doDownloadMods(true);
List<Mod> currentMods = await doScanMods(true);
@ -261,6 +263,8 @@ class StateMachine {
settings.sendRconCommand(
"broadcast The server will be going down for a restart in 5 minutes. The following mods have been updated: ${updatedMods.join(', ')}");
SessionData.timer.apply((5 * 60));
print(
"Scheduling restart for mod updates: ${updatedMods.join(', ')}");
SessionData.enableRestartTimer = true;
});
}
@ -268,12 +272,14 @@ class StateMachine {
// Check Total Seconds
if (SessionData.timer.getTotalSeconds() == 0 &&
SessionData.enableRestartTimer) {
print("Shutdown is pending, restart timer has hit zero");
SessionData.shutdownPending = true;
}
// Check Dead Process
if (DeadProcKillswitch.isCompleted) {
// Switch state
print("Dead process detected - Entering restart loop");
changeState(States.FullStop); // This has the stop logic
}