mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 12:49:51 +02:00
Added some shutdown debug
This commit is contained in:
parent
b0a22599e7
commit
143fc644d3
1 changed files with 10 additions and 0 deletions
|
@ -114,9 +114,11 @@ const ipcMain = electron.ipcMain;
|
||||||
|
|
||||||
var isShuttingDown = false;
|
var isShuttingDown = false;
|
||||||
function shutdown() {
|
function shutdown() {
|
||||||
|
log.debug("Normal shutdown (isShuttingDown: " + isShuttingDown + ")");
|
||||||
if (!isShuttingDown) {
|
if (!isShuttingDown) {
|
||||||
// if the home server is running, show a prompt before quit to ask if the user is sure
|
// if the home server is running, show a prompt before quit to ask if the user is sure
|
||||||
if (homeServer.state == ProcessGroupStates.STARTED) {
|
if (homeServer.state == ProcessGroupStates.STARTED) {
|
||||||
|
log.debug("Showing shutdown dialog.");
|
||||||
dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
type: 'question',
|
type: 'question',
|
||||||
buttons: ['Yes', 'No'],
|
buttons: ['Yes', 'No'],
|
||||||
|
@ -131,21 +133,26 @@ function shutdown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function forcedShutdown() {
|
function forcedShutdown() {
|
||||||
|
log.debug("Forced shutdown (isShuttingDown: " + isShuttingDown + ")");
|
||||||
if (!isShuttingDown) {
|
if (!isShuttingDown) {
|
||||||
shutdownCallback(0);
|
shutdownCallback(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function shutdownCallback(idx) {
|
function shutdownCallback(idx) {
|
||||||
|
log.debug("Entering shutdown callback.");
|
||||||
if (idx == 0 && !isShuttingDown) {
|
if (idx == 0 && !isShuttingDown) {
|
||||||
isShuttingDown = true;
|
isShuttingDown = true;
|
||||||
|
|
||||||
|
log.debug("Saving user config");
|
||||||
userConfig.save(configPath);
|
userConfig.save(configPath);
|
||||||
|
|
||||||
if (logWindow) {
|
if (logWindow) {
|
||||||
|
log.debug("Closing log window");
|
||||||
logWindow.close();
|
logWindow.close();
|
||||||
}
|
}
|
||||||
if (homeServer) {
|
if (homeServer) {
|
||||||
|
log.debug("Stoping home server");
|
||||||
homeServer.stop();
|
homeServer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,14 +160,17 @@ function shutdownCallback(idx) {
|
||||||
|
|
||||||
if (homeServer.state == ProcessGroupStates.STOPPED) {
|
if (homeServer.state == ProcessGroupStates.STOPPED) {
|
||||||
// if the home server is already down, take down the server console now
|
// if the home server is already down, take down the server console now
|
||||||
|
log.debug("Quitting.");
|
||||||
app.quit();
|
app.quit();
|
||||||
} else {
|
} else {
|
||||||
// if the home server is still running, wait until we get a state change or timeout
|
// if the home server is still running, wait until we get a state change or timeout
|
||||||
// before quitting the app
|
// before quitting the app
|
||||||
|
log.debug("Server still shutting down. Waiting");
|
||||||
var timeoutID = setTimeout(app.quit, 5000);
|
var timeoutID = setTimeout(app.quit, 5000);
|
||||||
homeServer.on('state-update', function(processGroup) {
|
homeServer.on('state-update', function(processGroup) {
|
||||||
if (processGroup.state == ProcessGroupStates.STOPPED) {
|
if (processGroup.state == ProcessGroupStates.STOPPED) {
|
||||||
clearTimeout(timeoutID);
|
clearTimeout(timeoutID);
|
||||||
|
log.debug("Quitting.");
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue