Add timer to shutdown procedure

This commit is contained in:
crschnick 2023-12-01 23:29:20 +00:00
parent faed51f996
commit 7a4e79af4f
2 changed files with 11 additions and 2 deletions

View file

@ -230,9 +230,9 @@ public abstract class OperationMode {
}
public static void shutdown(boolean inShutdownHook, boolean hasError) {
// In case we are stuck while in shutdown, allow for an external kill command to instantly exit this application
// In case we are stuck while in shutdown, instantly exit this application
if (inShutdown && inShutdownHook) {
TrackEvent.info("Received SIGTERM while in shutdown. Halting ...");
TrackEvent.info("Received another shutdown request while in shutdown hook. Halting ...");
OperationMode.halt(1);
}
@ -240,6 +240,14 @@ public abstract class OperationMode {
return;
}
// Run a timer to always exit after some time in case we get stuck
if (inShutdownHook) {
ThreadHelper.runAsync(() -> {
ThreadHelper.sleep(15000);
OperationMode.halt(1);
});
}
inShutdown = true;
OperationMode.inShutdownHook = inShutdownHook;
try {

View file

@ -43,6 +43,7 @@ public abstract class PlatformMode extends OperationMode {
while (App.getApp() == null) {
ThreadHelper.sleep(100);
}
TrackEvent.info("mode", "Application startup finished ...");
// If we downloaded an update, and decided to no longer automatically update, don't remind us!
// You can still update manually in the about tab