Bug Fixes plus improvement on console logging plus removing pYear and pMonth
This commit is contained in:
1 parent
146c7224ab
commit
93853807b0
20 files changed
+102
-886
No files matched your search
@@ -19,30 +19,21 @@
|
||||
|
||||
let processThisDependsOn; // This is the process this process needs to wait for it to finishes in order to start.
|
||||
|
||||
let month;
|
||||
let year;
|
||||
let currentProcessKey
|
||||
let datetimeForLogs = ''
|
||||
|
||||
return thisObject;
|
||||
|
||||
function initialize(pMonth, pYear, callBackFunction) {
|
||||
function initialize(callBackFunction) {
|
||||
|
||||
try {
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> Entering function."); }
|
||||
|
||||
month = pMonth;
|
||||
year = pYear;
|
||||
|
||||
if (month && year) {
|
||||
datetimeForLogs = "Month: " + month + " Year: " + year
|
||||
}
|
||||
|
||||
let name = 'Not Depends on any Process'
|
||||
|
||||
if (bot.processNode.referenceParent !== undefined) {
|
||||
|
||||
currentProcessKey = bot.processNode.referenceParent.name + "-" + bot.processNode.referenceParent.type + "-" + bot.processNode.referenceParent.id
|
||||
let market = bot.market.baseAsset + '/' + bot.market.quotedAsset
|
||||
currentProcessKey = bot.processNode.referenceParent.name + "-" + bot.processNode.referenceParent.type + "-" + bot.processNode.referenceParent.id + "-" + bot.exchange + "-" + market
|
||||
|
||||
if (bot.processNode.referenceParent.executionStartedEvent !== undefined) {
|
||||
if (bot.processNode.referenceParent.executionStartedEvent.referenceParent !== undefined) {
|
||||
@@ -51,9 +42,9 @@
|
||||
|
||||
name = processThisDependsOn.name
|
||||
if (processThisDependsOn.code.monthlyInstances === true) {
|
||||
logger.fileName = MODULE_NAME + "." + name + "." + year + "." + month;
|
||||
logger.fileName = MODULE_NAME + "." + name;
|
||||
}
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> " + currentProcessKey + datetimeForLogs + " depends on " + name); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> " + currentProcessKey + " depends on " + name); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,10 +70,9 @@
|
||||
/* This forces this process to wait until the process that this one depends on, emits its event signaling that the process execution has finished. */
|
||||
|
||||
let extraCallerId = '-' + Math.trunc(Math.random() * 10000) + '-'
|
||||
if (month) { extraCallerId = extraCallerId + '-' + month }
|
||||
if (year) { extraCallerId = extraCallerId + '-' + year }
|
||||
|
||||
let key = processThisDependsOn.name + "-" + processThisDependsOn.type + "-" + processThisDependsOn.id
|
||||
let market = bot.market.baseAsset + '/' + bot.market.quotedAsset
|
||||
let key = processThisDependsOn.name + "-" + processThisDependsOn.type + "-" + processThisDependsOn.id + "-" + bot.exchange + "-" + market
|
||||
let callerId = bot.dataMine + "-" + bot.codeName + "-" + bot.process + extraCallerId
|
||||
|
||||
let subscriptionId
|
||||
@@ -120,7 +110,7 @@
|
||||
global.SYSTEM_EVENT_HANDLER.createEventHandler(currentProcessKey, 'Process Execution Started')
|
||||
global.SYSTEM_EVENT_HANDLER.raiseEvent(currentProcessKey, 'Process Execution Started', event)
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> eventsCallBack -> " + currentProcessKey + " Process Execution Started because " + key + datetimeForLogs + " Finished."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> eventsCallBack -> " + currentProcessKey + " Process Execution Started because " + key + " Finished."); }
|
||||
}
|
||||
|
||||
callBackFunction(message.event.err);
|
||||
@@ -134,7 +124,7 @@
|
||||
global.SYSTEM_EVENT_HANDLER.createEventHandler(currentProcessKey, 'Process Execution Started')
|
||||
global.SYSTEM_EVENT_HANDLER.raiseEvent(currentProcessKey, 'Process Execution Started', event)
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> " + currentProcessKey + " Process Execution Started " + datetimeForLogs); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> " + currentProcessKey + " Process Execution Started " ); }
|
||||
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
}
|
||||
@@ -157,7 +147,8 @@
|
||||
|
||||
global.SYSTEM_EVENT_HANDLER.createEventHandler(currentProcessKey, 'Process Execution Finished')
|
||||
global.SYSTEM_EVENT_HANDLER.raiseEvent(currentProcessKey, 'Process Execution Finished', event)
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] finish -> " + currentProcessKey + " Process Execution Finished " + datetimeForLogs); }
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] finish -> " + currentProcessKey + " Process Execution Finished " ); }
|
||||
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
|
||||
|
||||
Reference in new issue
Block a user