From 8e19a5ac246a1f7b75e0fb6263a2437990cf18dd Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 12 Jun 2020 12:45:29 +0200 Subject: [PATCH] fix on stop --- IndicatorBot.js | 6 +++++- Root.js | 3 --- SensorBot.js | 6 +++++- TradingBot.js | 6 +++++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/IndicatorBot.js b/IndicatorBot.js index 30537cb6f..dbe4b844f 100644 --- a/IndicatorBot.js +++ b/IndicatorBot.js @@ -789,7 +789,11 @@ logger.persist(); clearInterval(fixedTimeLoopIntervalHandle); clearTimeout(nextLoopTimeoutHandle); - callBackFunction(global.DEFAULT_FAIL_RESPONSE); + if (global.unexpectedError !== undefined) { + callBackFunction(global.DEFAULT_FAIL_RESPONSE) + } else { + callBackFunction(global.DEFAULT_OK_RESPONSE) + } } } catch (err) { diff --git a/Root.js b/Root.js index 0070316cf..cecc40636 100644 --- a/Root.js +++ b/Root.js @@ -404,14 +404,11 @@ let botId = pBotConfig.dataMine + "." + pBotConfig.codeName + "." + pBotConfig.process; if (err.result === global.DEFAULT_OK_RESPONSE.result) { - logger.write(MODULE_NAME, "[INFO] start -> bootingBot -> runSensorBot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully."); logger.write(MODULE_NAME, "[INFO] start -> bootingBot -> runSensorBot -> onInitializeReady -> whenStartFinishes -> Bot Id = " + botId); logger.persist(); - } else { - logger.write(MODULE_NAME, "[ERROR] start -> bootingBot -> runSensorBot -> onInitializeReady -> whenStartFinishes -> err = " + err.message); logger.write(MODULE_NAME, "[ERROR] start -> bootingBot -> runSensorBot -> onInitializeReady -> whenStartFinishes -> Execution will be stopped. "); logger.write(MODULE_NAME, "[ERROR] start -> bootingBot -> runSensorBot -> onInitializeReady -> whenStartFinishes -> Bye."); diff --git a/SensorBot.js b/SensorBot.js index c53f95071..d8f8aaa32 100644 --- a/SensorBot.js +++ b/SensorBot.js @@ -597,7 +597,11 @@ logger.persist(); clearInterval(fixedTimeLoopIntervalHandle); clearTimeout(nextLoopTimeoutHandle); - callBackFunction(global.DEFAULT_FAIL_RESPONSE); + if (global.unexpectedError !== undefined) { + callBackFunction(global.DEFAULT_FAIL_RESPONSE) + } else { + callBackFunction(global.DEFAULT_OK_RESPONSE) + } } } diff --git a/TradingBot.js b/TradingBot.js index c62a11434..8b16f955e 100644 --- a/TradingBot.js +++ b/TradingBot.js @@ -724,7 +724,11 @@ logger.persist(); clearInterval(fixedTimeLoopIntervalHandle); clearTimeout(nextLoopTimeoutHandle); - callBackFunction(global.DEFAULT_FAIL_RESPONSE); + if (global.unexpectedError !== undefined) { + callBackFunction(global.DEFAULT_FAIL_RESPONSE) + } else { + callBackFunction(global.DEFAULT_OK_RESPONSE) + } } function sessionStopped() {