diff --git a/IndicatorBotProcessMainLoop.js b/IndicatorBotProcessMainLoop.js index 1ec9eb324..9017258db 100644 --- a/IndicatorBotProcessMainLoop.js +++ b/IndicatorBotProcessMainLoop.js @@ -964,6 +964,7 @@ logger.persist(); } + processStopped() callBackFunction(global.DEFAULT_OK_RESPONSE); return; @@ -1076,11 +1077,12 @@ } } - function processHeartBeat(processingDate, percentage) { + function processHeartBeat(processingDate, percentage, status) { let event = { seconds: (new Date()).getSeconds(), processingDate: processingDate, - percentage: percentage + percentage: percentage, + status: status } global.SYSTEM_EVENT_HANDLER.raiseEvent(bot.processKey, 'Heartbeat', event) } diff --git a/ProcessExecutionEvents.js b/ProcessExecutionEvents.js index ed79e1be7..4f26e7708 100644 --- a/ProcessExecutionEvents.js +++ b/ProcessExecutionEvents.js @@ -83,6 +83,8 @@ global.SYSTEM_EVENT_HANDLER.listenToEvent(key, 'Process Execution Finished', undefined, callerId, responseCallBack, eventsCallBack) + bot.processHeartBeat(undefined, undefined, "Waiting for " + processThisDependsOn.parentNode.parentNode.name + "->" + processThisDependsOn.parentNode.code.codeName + "->" + processThisDependsOn.code.codeName) + function responseCallBack(message) { if (message.result !== global.DEFAULT_OK_RESPONSE.result) { logger.write(MODULE_NAME, "[ERROR] start -> responseCallBack -> message = " + JSON.stringify(message)) @@ -110,6 +112,8 @@ global.SYSTEM_EVENT_HANDLER.createEventHandler(currentProcessKey, 'Process Execution Started') global.SYSTEM_EVENT_HANDLER.raiseEvent(currentProcessKey, 'Process Execution Started', event) + bot.processHeartBeat(undefined, undefined,"Running") + if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> eventsCallBack -> " + currentProcessKey + " Process Execution Started because " + key + " Finished."); } } diff --git a/SensorBotProcessMainLoop.js b/SensorBotProcessMainLoop.js index 232131119..4eecc7e54 100644 --- a/SensorBotProcessMainLoop.js +++ b/SensorBotProcessMainLoop.js @@ -676,6 +676,7 @@ clearTimeout(nextLoopTimeoutHandle); clearTimeout(checkLoopHealthHandle); bot.enableCheckLoopHealth = false; + processStopped() callBackFunction(global.DEFAULT_OK_RESPONSE); return; @@ -812,11 +813,12 @@ } } - function processHeartBeat(processingDate, percentage) { + function processHeartBeat(processingDate, percentage, status) { let event = { seconds: (new Date()).getSeconds(), processingDate: processingDate, - percentage: percentage + percentage: percentage, + status: status } global.SYSTEM_EVENT_HANDLER.raiseEvent(bot.processKey, 'Heartbeat', event) } diff --git a/TradingBotProcessMainLoop.js b/TradingBotProcessMainLoop.js index 5d4034129..473a5b93d 100644 --- a/TradingBotProcessMainLoop.js +++ b/TradingBotProcessMainLoop.js @@ -880,6 +880,7 @@ } global.SYSTEM_EVENT_HANDLER.raiseEvent(bot.sessionKey, 'Stopped') + processStopped() callBackFunction(global.DEFAULT_OK_RESPONSE); return; @@ -1000,11 +1001,12 @@ } } - function processHeartBeat(processingDate, percentage) { + function processHeartBeat(processingDate, percentage, status) { let event = { seconds: (new Date()).getSeconds(), processingDate: processingDate, - percentage: percentage + percentage: percentage, + status: status } global.SYSTEM_EVENT_HANDLER.raiseEvent(bot.processKey, 'Heartbeat', event) }