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