mirror of
https://github.com/jwinterm/nodejs-pool.git
synced 2026-10-17 05:21:27 +02:00
Avoid spamming the administrator when the daemon is stuck.
This commit is contained in:
+18
-3
@@ -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() {
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user