From a5fb6c0a645eab5c55bd5768e0fe506b60b0edfe Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 18 Jun 2018 12:01:07 +0200 Subject: [PATCH] Not stopping loop when config file can not be read at ShallWeStop --- ExtractionBotProcessMainLoop.js | 14 ++++++++++---- IndicatorBotProcessMainLoop.js | 14 ++++++++++---- TradingBotProcessMainLoop.js | 14 ++++++++++---- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/ExtractionBotProcessMainLoop.js b/ExtractionBotProcessMainLoop.js index 2a9c69865..73d5a4eb7 100644 --- a/ExtractionBotProcessMainLoop.js +++ b/ExtractionBotProcessMainLoop.js @@ -610,11 +610,17 @@ function onFileReceived(err, text) { if (err.result !== global.DEFAULT_OK_RESPONSE.result) { + + /* + If for any reason this config file cannot be read, we are not going to abort the loop for that. Instead we are going to assume + that there are no instructions to stop and we will keep the show running. + */ + logger.write(MODULE_NAME, "[ERROR] run -> loop -> shallWeStop -> onFileReceived -> err.message = " + err.message); - logger.persist(); - clearInterval(intervalHandle); - clearTimeout(timeoutHandle); - callBackFunction(global.DEFAULT_FAIL_RESPONSE); + logger.write(MODULE_NAME, "[ERROR] run -> loop -> shallWeStop -> onFileReceived -> The config file cound not be read. "); + logger.write(MODULE_NAME, "[ERROR] run -> loop -> shallWeStop -> onFileReceived -> We will ignore its content and continue running the loop. "); + + continueCallBack(); return; } diff --git a/IndicatorBotProcessMainLoop.js b/IndicatorBotProcessMainLoop.js index a1c965857..e2468d049 100644 --- a/IndicatorBotProcessMainLoop.js +++ b/IndicatorBotProcessMainLoop.js @@ -587,11 +587,17 @@ function onFileReceived(err, text) { if (err.result !== global.DEFAULT_OK_RESPONSE.result) { + + /* + If for any reason this config file cannot be read, we are not going to abort the loop for that. Instead we are going to assume + that there are no instructions to stop and we will keep the show running. + */ + logger.write(MODULE_NAME, "[ERROR] run -> loop -> shallWeStop -> onFileReceived -> err.message = " + err.message); - logger.persist(); - clearInterval(intervalHandle); - clearTimeout(timeoutHandle); - callBackFunction(global.DEFAULT_FAIL_RESPONSE); + logger.write(MODULE_NAME, "[ERROR] run -> loop -> shallWeStop -> onFileReceived -> The config file cound not be read. "); + logger.write(MODULE_NAME, "[ERROR] run -> loop -> shallWeStop -> onFileReceived -> We will ignore its content and continue running the loop. "); + + continueCallBack(); return; } diff --git a/TradingBotProcessMainLoop.js b/TradingBotProcessMainLoop.js index 03c4cd178..af52b8ce2 100644 --- a/TradingBotProcessMainLoop.js +++ b/TradingBotProcessMainLoop.js @@ -1020,11 +1020,17 @@ function onFileReceived(err, text) { if (err.result !== global.DEFAULT_OK_RESPONSE.result) { + + /* + If for any reason this config file cannot be read, we are not going to abort the loop for that. Instead we are going to assume + that there are no instructions to stop and we will keep the show running. + */ + logger.write(MODULE_NAME, "[ERROR] run -> loop -> shallWeStop -> onFileReceived -> err.message = " + err.message); - logger.persist(); - clearInterval(intervalHandle); - clearTimeout(timeoutHandle); - callBackFunction(global.DEFAULT_FAIL_RESPONSE); + logger.write(MODULE_NAME, "[ERROR] run -> loop -> shallWeStop -> onFileReceived -> The config file cound not be read. "); + logger.write(MODULE_NAME, "[ERROR] run -> loop -> shallWeStop -> onFileReceived -> We will ignore its content and continue running the loop. "); + + continueCallBack(); return; }