diff --git a/lib/worker.js b/lib/worker.js index 0723bc0..1a0e545 100644 --- a/lib/worker.js +++ b/lib/worker.js @@ -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() { } }) }); + }); }