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

+12
View File
@@ -461,10 +461,12 @@
case 'Normal': {
if (bot.runAtFixedInterval === true) {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> loopControl -> Fixed Interval Normal exit point reached."); }
setTimeout(checkLoopHealth, bot.fixedInterval * 5, bot.loopCounter);
logger.persist();
return;
} else {
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();
}
@@ -472,6 +474,7 @@
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();
}
@@ -504,6 +507,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 {