Cleaning and changes to make processes run according to the timing specified at the configuration

This commit is contained in:
Luis Fernando Molina committed 2019-09-10 21:01:48 +02:00
1 parent 4a079accbf
commit 2fc03951aa
10 files changed
+150 -1492

No files matched your search

+7 -7
View File
@@ -557,7 +557,7 @@
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> loopControl -> onStop -> Stopping the Loop Gracefully. See you next time!"); }
if(global.FULL_LOG === 'true'){
if(global.WRITE_LOGS_TO_FILES === 'true'){
logger.persist();
}
@@ -581,15 +581,15 @@
if (bot.runAtFixedInterval === true) {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> loopControl -> Fixed Interval Normal exit point reached."); }
checkLoopHealthHandle = setTimeout(checkLoopHealth, bot.fixedInterval * 5, bot.loopCounter);
if(global.FULL_LOG === 'true'){
if(global.WRITE_LOGS_TO_FILES === 'true'){
logger.persist();
}
return;
} else {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> loopControl -> Restarting Loop in " + (processConfig.normalWaitTime / 1000) + " seconds."); }
checkLoopHealthHandle = setTimeout(checkLoopHealth, processConfig.normalWaitTime * 5, bot.loopCounter);
checkLoopHealthHandle = setTimeout(checkLoopHealth, processConfig.deadWaitTime * 5, bot.loopCounter);
nextLoopTimeoutHandle = setTimeout(loop, processConfig.normalWaitTime);
if(global.FULL_LOG === 'true'){
if(global.WRITE_LOGS_TO_FILES === 'true'){
logger.persist();
}
}
@@ -643,7 +643,7 @@
let now = new Date().valueOf();
if (now - bot.loopStartTime > processConfig.normalWaitTime) {
if (now - bot.loopStartTime > processConfig.deadWaitTime) {
logger.write(MODULE_NAME, "[ERROR] run -> loop -> checkLoopHealth -> Dead loop found -> pLastLoop = " + pLastLoop);
console.log((new Date().toISOString() + " [ERROR] run -> loop -> checkLoopHealth -> " + pad(bot.codeName, 20) + " " + pad(bot.process, 30) + " Loop # " + pad(Number(bot.loopCounter), 5) + " found dead. Resurrecting it now."));
@@ -672,7 +672,7 @@
if (process.env.STOP_GRACEFULLY !== undefined)
stop = JSON.parse(process.env.STOP_GRACEFULLY)
if (!stop && global.SHALL_BOT_STOP === false) {
if (!stop) {
continueCallBack();
} else {
stopCallBack();
@@ -700,7 +700,7 @@
}
function hearBeat() {
let key = global.USER_DEFINITION.bot.processes[global.sequenceStep - 1].name + '-' + global.USER_DEFINITION.bot.processes[global.sequenceStep - 1].type + '-' + global.USER_DEFINITION.bot.processes[global.sequenceStep - 1].id
let key = global.USER_DEFINITION.bot.processes[bot.processIndex].name + '-' + global.USER_DEFINITION.bot.processes[bot.processIndex].type + '-' + global.USER_DEFINITION.bot.processes[bot.processIndex].id
let event = {
seconds: (new Date()).getSeconds()