checkLoopHealth

This commit is contained in:
Luis Fernando Molina committed 2018-06-08 14:32:02 +02:00
1 parent 33f065bd28
commit 55f5d08cbc
3 files changed
+34

No files matched your search

+11
View File
@@ -442,12 +442,14 @@
switch (nextWaitTime) {
case 'Normal': {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> loopControl -> Restarting Loop in " + (processConfig.normalWaitTime / 1000) + " seconds."); }
setTimeout(checkLoopHealth, processConfig.normalWaitTime * 5, bot.loopCounter);
setTimeout(loop, processConfig.normalWaitTime);
logger.persist();
}
break;
case 'Retry': {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> loopControl -> Restarting Loop in " + (processConfig.retryWaitTime / 1000) + " seconds."); }
setTimeout(checkLoopHealth, processConfig.retryWaitTime * 5, bot.loopCounter);
setTimeout(loop, processConfig.retryWaitTime);
logger.persist();
}
@@ -468,6 +470,15 @@
}
}
function checkLoopHealth(pLastLoop) {
if (bot.loopCounter === pLastLoop + 1) { // This means that the next loop started but also stopped executing abruptally.
logger.persist(); // We persist the logs of the failed execution.
loop(); // We restart the loop so that the processing can continue.
}
}
function shallWeStop(stopCallBack, continueCallBack) {
try {