Check for startup when receiving shutdown notice

This commit is contained in:
crschnick 2024-08-31 08:21:36 +00:00
parent 26762d4d80
commit b8a981eb1f
2 changed files with 7 additions and 0 deletions

View file

@ -255,6 +255,12 @@ public abstract class OperationMode {
}
public static void shutdown(boolean inShutdownHook, boolean hasError) {
// We can receive shutdown events while we are still starting up
// In that case ignore them until we are finished
if (isInStartup()) {
return;
}
// In case we are stuck while in shutdown, instantly exit this application
if (inShutdown && inShutdownHook) {
TrackEvent.info("Received another shutdown request while in shutdown hook. Halting ...");

View file

@ -157,6 +157,7 @@ public class SentryErrorHandler implements ErrorHandler {
"logs",
Boolean.toString(
ee.isShouldSendDiagnostics() && !ee.getAttachments().isEmpty()));
s.setTag("inStartup", Boolean.toString(OperationMode.isInStartup()));
s.setTag("inShutdown", Boolean.toString(OperationMode.isInShutdown()));
s.setTag("unhandled", Boolean.toString(ee.isUnhandled()));