From 3af9b559dfb367ff796601020bccb9b7e607b435 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 4 Feb 2020 18:21:27 +0100 Subject: [PATCH] Restarting Sessions --- Session.js | 1 + TradingBotProcessMainLoop.js | 4 ++-- server.js | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Session.js b/Session.js index 920dcde9f..fc6f295d2 100644 --- a/Session.js +++ b/Session.js @@ -44,6 +44,7 @@ return function runSession(message) { + if (bot.SESSION_STATUS === 'Idle' || bot.SESSION_STATUS === 'Running') { return } // This happens when the UI is reloaded, the session was running and tries to run it again. /* We are going to run the Definition comming at the event. */ bot.TRADING_SYSTEM = JSON.parse(message.event.tradingSystem) diff --git a/TradingBotProcessMainLoop.js b/TradingBotProcessMainLoop.js index 01a0ce2dc..e2ef012a6 100644 --- a/TradingBotProcessMainLoop.js +++ b/TradingBotProcessMainLoop.js @@ -208,7 +208,7 @@ processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(bot, logger) - processExecutionEvents.initialize(undefined, undefined, onInizialized); + processExecutionEvents.initialize(onInizialized); function onInizialized(err) { @@ -356,7 +356,7 @@ statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(bot, logger, STATUS_REPORT, UTILITIES); - statusDependencies.initialize(undefined, undefined, onInizialized); + statusDependencies.initialize(onInizialized); function onInizialized(err) { diff --git a/server.js b/server.js index 700940611..8d5c2d432 100644 --- a/server.js +++ b/server.js @@ -40,9 +40,8 @@ process.on('unhandledRejection', (reason, p) => { }) process.on('exit', function (code) { - + /* We send an event signaling that the Task is being terminated. */ - let key = global.TASK_NODE.name + '-' + global.TASK_NODE.type + '-' + global.TASK_NODE.id global.SYSTEM_EVENT_HANDLER.raiseEvent(key, 'Stopped') // Meaning Task Stopped