Avoid spamming the administrator when the daemon is stuck.

master
adaxi 6 years ago
parent 308f2f0135
commit 774a5254cc

@ -504,13 +504,27 @@ function updateWalletStats() {
}
let lastBlockCheckIsOk = true;
function monitorNodes() {
global.coinFuncs.getLastBlockHeader((err, block) => {
if (err !== null) {
return global.support.sendEmail(
if (lastBlockCheckIsOk) {
lastBlockCheckIsOk = false;
global.support.sendEmail(
global.config.general.adminEmail,
'Failed to query daemon for last block header',
`The worker failed to return last block header. Please verify if the daemon is running properly.`
);
}
return
}
if (!lastBlockCheckIsOk) {
lastBlockCheckIsOk = true;
global.support.sendEmail(
global.config.general.adminEmail,
'Failed to query daemon for last block header',
`The worker failed to return last block header. Please verify if the daemon is running properly.`
'Quering daemon for last block header is back to normal',
`An warning was sent to you indicating that the the worker failed to return the last block header.
The issue seems to be solved now.`
);
}
const sql = 'SELECT blockID, hostname, ip FROM pools WHERE last_checkin > DATE_SUB(NOW(), INTERVAL 30 MINUTE)';
@ -525,6 +539,7 @@ function monitorNodes() {
}
})
});
});
}

Loading…
Cancel
Save