From 78e5c1961403f08d5c224e86f633c668cd93bdcd Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 4 Jun 2018 13:02:42 +0200 Subject: [PATCH] All logging issues fixed. --- ExtractionBotProcessMainLoop.js | 52 ++++++++++++++++----------------- IndicatorBotProcessMainLoop.js | 52 ++++++++++++++++----------------- TradingBotProcessMainLoop.js | 52 ++++++++++++++++----------------- 3 files changed, 78 insertions(+), 78 deletions(-) diff --git a/ExtractionBotProcessMainLoop.js b/ExtractionBotProcessMainLoop.js index 15c670430..9cb3f7b3c 100644 --- a/ExtractionBotProcessMainLoop.js +++ b/ExtractionBotProcessMainLoop.js @@ -544,38 +544,38 @@ callBackFunction(global.DEFAULT_FAIL_RESPONSE); return; } + } - let fileName = "this.config.json"; + let fileName = "this.config.json"; - cloudStorage.getTextFile(filePath, fileName, onFileReceived); + cloudStorage.getTextFile(filePath, fileName, onFileReceived); - function onFileReceived(err, text) { + function onFileReceived(err, text) { - if (err.result !== global.DEFAULT_OK_RESPONSE.result) { - logger.write("[ERROR] run -> loopControl -> shallWeStop -> onFileReceived -> err.message = " + err.message); - bot.eventHandler.raiseEvent("Close Log File"); - clearInterval(intervalHandle); - callBackFunction(global.DEFAULT_FAIL_RESPONSE); - return; + if (err.result !== global.DEFAULT_OK_RESPONSE.result) { + logger.write("[ERROR] run -> loopControl -> shallWeStop -> onFileReceived -> err.message = " + err.message); + bot.eventHandler.raiseEvent("Close Log File"); + clearInterval(intervalHandle); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); + return; + } + + try { + + let configRead = JSON.parse(text); + + if (configRead.stopGracefully === false && global.SHALL_BOT_STOP === false) { + continueCallBack(); + } else { + stopCallBack(); } - try { - - let configRead = JSON.parse(text); - - if (configRead.stopGracefully === false && global.SHALL_BOT_STOP === false) { - continueCallBack(); - } else { - stopCallBack(); - } - - } catch (err) { - logger.write("[ERROR] run -> loopControl -> shallWeStop -> onFileReceived -> err.message = " + err.message); - bot.eventHandler.raiseEvent("Close Log File"); - clearInterval(intervalHandle); - callBackFunction(global.DEFAULT_FAIL_RESPONSE); - return; - } + } catch (err) { + logger.write("[ERROR] run -> loopControl -> shallWeStop -> onFileReceived -> err.message = " + err.message); + bot.eventHandler.raiseEvent("Close Log File"); + clearInterval(intervalHandle); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); + return; } } } diff --git a/IndicatorBotProcessMainLoop.js b/IndicatorBotProcessMainLoop.js index ba39349b9..0a7e24b80 100644 --- a/IndicatorBotProcessMainLoop.js +++ b/IndicatorBotProcessMainLoop.js @@ -497,38 +497,38 @@ callBackFunction(global.DEFAULT_FAIL_RESPONSE); return; } + } - let fileName = "this.config.json"; + let fileName = "this.config.json"; - cloudStorage.getTextFile(filePath, fileName, onFileReceived); + cloudStorage.getTextFile(filePath, fileName, onFileReceived); - function onFileReceived(err, text) { + function onFileReceived(err, text) { - if (err.result !== global.DEFAULT_OK_RESPONSE.result) { - logger.write("[ERROR] run -> loopControl -> shallWeStop -> onFileReceived -> err.message = " + err.message); - bot.eventHandler.raiseEvent("Close Log File"); - clearInterval(intervalHandle); - callBackFunction(global.DEFAULT_FAIL_RESPONSE); - return; + if (err.result !== global.DEFAULT_OK_RESPONSE.result) { + logger.write("[ERROR] run -> loopControl -> shallWeStop -> onFileReceived -> err.message = " + err.message); + bot.eventHandler.raiseEvent("Close Log File"); + clearInterval(intervalHandle); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); + return; + } + + try { + + let configRead = JSON.parse(text); + + if (configRead.stopGracefully === false && global.SHALL_BOT_STOP === false) { + continueCallBack(); + } else { + stopCallBack(); } - try { - - let configRead = JSON.parse(text); - - if (configRead.stopGracefully === false && global.SHALL_BOT_STOP === false) { - continueCallBack(); - } else { - stopCallBack(); - } - - } catch (err) { - logger.write("[ERROR] run -> loopControl -> shallWeStop -> onFileReceived -> err.message = " + err.message); - bot.eventHandler.raiseEvent("Close Log File"); - clearInterval(intervalHandle); - callBackFunction(global.DEFAULT_FAIL_RESPONSE); - return; - } + } catch (err) { + logger.write("[ERROR] run -> loopControl -> shallWeStop -> onFileReceived -> err.message = " + err.message); + bot.eventHandler.raiseEvent("Close Log File"); + clearInterval(intervalHandle); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); + return; } } } diff --git a/TradingBotProcessMainLoop.js b/TradingBotProcessMainLoop.js index 2b4436fcf..dc80d799f 100644 --- a/TradingBotProcessMainLoop.js +++ b/TradingBotProcessMainLoop.js @@ -906,38 +906,38 @@ callBackFunction(global.DEFAULT_FAIL_RESPONSE); return; } + } - let fileName = "this.config.json"; + let fileName = "this.config.json"; - cloudStorage.getTextFile(filePath, fileName, onFileReceived); + cloudStorage.getTextFile(filePath, fileName, onFileReceived); - function onFileReceived(err, text) { + function onFileReceived(err, text) { - if (err.result !== global.DEFAULT_OK_RESPONSE.result) { - logger.write("[ERROR] run -> loopControl -> shallWeStop -> onFileReceived -> err.message = " + err.message); - bot.eventHandler.raiseEvent("Close Log File"); - clearInterval(intervalHandle); - callBackFunction(global.DEFAULT_FAIL_RESPONSE); - return; + if (err.result !== global.DEFAULT_OK_RESPONSE.result) { + logger.write("[ERROR] run -> loopControl -> shallWeStop -> onFileReceived -> err.message = " + err.message); + bot.eventHandler.raiseEvent("Close Log File"); + clearInterval(intervalHandle); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); + return; + } + + try { + + let configRead = JSON.parse(text); + + if (configRead.stopGracefully === false && global.SHALL_BOT_STOP === false) { + continueCallBack(); + } else { + stopCallBack(); } - try { - - let configRead = JSON.parse(text); - - if (configRead.stopGracefully === false && global.SHALL_BOT_STOP === false) { - continueCallBack(); - } else { - stopCallBack(); - } - - } catch (err) { - logger.write("[ERROR] run -> loopControl -> shallWeStop -> onFileReceived -> err.message = " + err.message); - bot.eventHandler.raiseEvent("Close Log File"); - clearInterval(intervalHandle); - callBackFunction(global.DEFAULT_FAIL_RESPONSE); - return; - } + } catch (err) { + logger.write("[ERROR] run -> loopControl -> shallWeStop -> onFileReceived -> err.message = " + err.message); + bot.eventHandler.raiseEvent("Close Log File"); + clearInterval(intervalHandle); + callBackFunction(global.DEFAULT_FAIL_RESPONSE); + return; } } }