From aeb76f98bc45d45046c104d312faefea4fd10a8b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 1 Oct 2019 12:52:59 +0200 Subject: [PATCH] Bug Fixed at end of the month --- Single-Period-Daily/User.Bot.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Single-Period-Daily/User.Bot.js b/Single-Period-Daily/User.Bot.js index ddaa2329d..c94fbcbe8 100644 --- a/Single-Period-Daily/User.Bot.js +++ b/Single-Period-Daily/User.Bot.js @@ -488,9 +488,20 @@ if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> findLastCandleCloseValue -> loopStart -> onFileReceived -> Entering function."); } + /* + There is a situation at the end of each month where the process might have been started at the new month before dependent processes have + created the expected file. For those cases we will retry instead of just aborting the process. + */ + if (err.result === global.CUSTOM_FAIL_RESPONSE.result && err.message === 'File does not exist.') { + logger.write(MODULE_NAME, "[WARN] start -> findLastCandleCloseValue -> loopStart -> onFileReceived -> err received = " + err.stack); + logger.write(MODULE_NAME, "[WARN] start -> findLastCandleCloseValue -> loopStart -> onFileReceived -> text received = " + text); + callBackFunction(global.DEFAULT_RETRY_RESPONSE); + return; + } + if (err.result !== global.DEFAULT_OK_RESPONSE.result) { - logger.write(MODULE_NAME, "[ERROR] start -> findLastCandleCloseValue -> loopStart -> onFileReceived -> err = " + err.stack); - logger.write(MODULE_NAME, "[ERROR] start -> findLastCandleCloseValue -> loopStart -> onFileReceived -> text = " + text); + logger.write(MODULE_NAME, "[ERROR] start -> findLastCandleCloseValue -> loopStart -> onFileReceived -> err received = " + err.stack); + logger.write(MODULE_NAME, "[ERROR] start -> findLastCandleCloseValue -> loopStart -> onFileReceived -> text received = " + text); callBackFunction(err); return; }