Browse Source

komodod quit timeout fix

all-modes
pbca26 7 years ago
parent
commit
a2df2cd8e0
  1. 11
      main.js
  2. 18
      routes/shepherd.js

11
main.js

@ -71,10 +71,10 @@ shepherd.writeLog(`os_release: ${os.release()}`);
shepherd.writeLog(`os_type: ${os.type()}`);
var appConfig = shepherd.loadLocalConfig(); // load app config
appConfig['daemonTest'] = false; // shadow setting
appConfig['daemonOutput'] = false; // shadow setting
let __defaultAppSettings = require('./routes/appConfig.js').config;
__defaultAppSettings['daemonTest'] = false; // shadow setting
__defaultAppSettings['daemonOutput'] = false; // shadow setting
const _defaultAppSettings = __defaultAppSettings;
shepherd.writeLog(`app started in ${(appConfig.dev ? 'dev mode' : ' user mode')}`);
@ -288,7 +288,7 @@ function createAppSettingsWindow() {
// initialise window
appSettingsWindow = new BrowserWindow({ // dirty hack to prevent main window flash on quit
width: 750,
height: 800,
height: 820,
frame: false,
icon: iguanaIcon,
show: false,
@ -302,6 +302,8 @@ function createAppSettingsWindow() {
appSettingsWindow.testLocation = shepherd.testLocation;
appSettingsWindow.setDefaultAppSettings = setDefaultAppSettings;
appSettingsWindow.updateAppSettings = updateAppSettings;
appSettingsWindow.testBins = shepherd.testBins;
appSettingsWindow.zcashParamsExist = _zcashParamsExist;
appSettingsWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort}/gui/app-settings.html`);
appSettingsWindow.webContents.on('did-finish-load', function() {
@ -407,7 +409,7 @@ function createWindow(status) {
shepherd.writeLog('exiting app...');
shepherd.dumpCacheBeforeExit();
shepherd.quitKomodod();
shepherd.quitKomodod(1000);
pm2.connect(true, function(err) {
console.log('connecting to pm2...');
@ -526,6 +528,7 @@ app.on('window-all-closed', function() {
// Calling event.preventDefault() will prevent the default behaviour, which is terminating the application.
app.on('before-quit', function(event) {
console.log('before-quit');
shepherd.killRogueProcess('iguana'); // kill any rogue iguana core instances
if (!forceQuitApp && mainWindow === null && loadingWindow != null) { // mainWindow not intitialised and loadingWindow not dereferenced
// loading window is still open
console.log('before-quit prevented');

18
routes/shepherd.js

@ -477,6 +477,7 @@ shepherd.zcashParamsExist = function() {
provingKeySize: false,
verifyingKey: _fs.existsSync(`${zcashParamsDir}/sprout-verifying.key`),
verifyingKeySize: false,
errors: false,
};
if (_checkList.rootDir &&
@ -492,12 +493,20 @@ shepherd.zcashParamsExist = function() {
if (_verifyingKeySize.size === 1449) {
_checkList.verifyingKeySize = true;
}
console.log('zcashparams exist');
} else {
console.log('zcashparams doesnt exist');
}
console.log(JSON.stringify(_checkList, null, '\t'));
if (!_checkList.rootDir ||
!_checkList.provingKey ||
!_checkList.verifyingKey ||
!_checkList.provingKeySize ||
!_checkList.verifyingKeySize) {
_checkList.errors = true;
}
return _checkList;
}
@ -1216,7 +1225,7 @@ shepherd.quitKomodod = function(timeout = 100) {
for (let key in coindInstanceRegistry) {
const chain = key !== 'komodod' ? key : null;
coindExitInterval[key] = setInterval(function() {
function execCliStop() {
let _arg = [];
if (chain) {
_arg.push(`-ac_name=${chain}`);
@ -1240,6 +1249,11 @@ shepherd.quitKomodod = function(timeout = 100) {
}
shepherd.killRogueProcess('komodo-cli');
});
}
execCliStop();
coindExitInterval[key] = setInterval(function() {
execCliStop();
}, timeout);
}
}

Loading…
Cancel
Save