Process Instance Variables

This commit is contained in:
Luis Fernando Molina committed 2020-11-28 17:18:16 +01:00
1 parent 8620b24f17
commit 529226dfdc
5 files changed
+20 -15

No files matched your search

+6
View File
@@ -367,6 +367,12 @@
"propertyName": "nodeJSConstants",
"functionName": "newSuperalgosGlobalsNodeJSConstants",
"fileName": "NodeJSConstants.js"
},
{
"name": "Logger Variables",
"propertyName": "loggerVariables",
"functionName": "newSuperalgosGlobalsLoggerVariables",
"fileName": "LoggerVariables.js"
}
],
"functionLibraries": [
@@ -0,0 +1,7 @@
exports.newSuperalgosGlobalsLoggerVariables = function () {
let thisObject = {
DELETE_QUEUE_SIZE: 10
}
return thisObject
}
@@ -6,7 +6,8 @@ exports.newSuperalgosGlobalsProcessVariables = function () {
*/
let thisObject = {
ENDED_PROCESSES_COUNTER: 0,
TOTAL_PROCESS_INSTANCES_CREATED: 0
TOTAL_PROCESS_INSTANCES_CREATED: 0,
VARIABLES_BY_PROCESS_INDEX_MAP: new Map()
}
return thisObject
+4 -9
View File
@@ -112,11 +112,6 @@ exports.newDebugLog = function (processIndex) {
}
}
if (thisObject.bot.debug.year !== undefined) {
filePath = filePath + "/" + thisObject.bot.debug.year + "/" + thisObject.bot.debug.month;
}
let fileName;
if (internalLoopCounter >= 0) {
fileName = "Loop." + pad(thisObject.bot.loopCounter, 8) + "." + pad(internalLoopCounter, 4) + ".json";
@@ -128,11 +123,11 @@ exports.newDebugLog = function (processIndex) {
/* This is the implementation of the mechanism to auto-mantain logs. */
if (contentToPersist.indexOf('[ERROR]') < 0 && contentToPersist.indexOf('[PERSIST]') < 0 && contentToPersist.indexOf('[IMPORTANT]') < 0) {
thisObject.bot.LOGS_TO_DELETE_QUEUE.push(filePath + '/' + fileName)
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).LOGS_TO_DELETE_QUEUE.push(filePath + '/' + fileName)
}
if (thisObject.bot.LOGS_TO_DELETE_QUEUE.length > thisObject.bot.DELETE_QUEUE_SIZE) {
let fileToDelete = thisObject.bot.LOGS_TO_DELETE_QUEUE[0]
thisObject.bot.LOGS_TO_DELETE_QUEUE.splice(0, 1)
if (TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).LOGS_TO_DELETE_QUEUE.length > TS.projects.superalgos.globals.loggerVariables.DELETE_QUEUE_SIZE) {
let fileToDelete = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).LOGS_TO_DELETE_QUEUE[0]
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).LOGS_TO_DELETE_QUEUE.splice(0, 1)
/* Will delete this file only if it does not contains ERROR inside. */
let fileContent = fileStorage.getTextFile(fileToDelete, onGetFile, true)
function onGetFile(err, fileContent) {
+1 -5
View File
@@ -32,11 +32,7 @@
TS.projects.superalgos.globals.taskVariables.LOGGER_MAP.set('Pre-Bot-Main-Loop' + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].id, logger)
logger.bot = botConfig;
botConfig.debug = {};
/* Logs Mantainance Stuff */
botConfig.LOGS_TO_DELETE_QUEUE = []
botConfig.DELETE_QUEUE_SIZE = 10 // This number represents how many log files can be at the queue at any point in time, which means how many logs are not still deleted.
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.set(processIndex, {LOGS_TO_DELETE_QUEUE: []})
/* Loop Counter */
botConfig.loopCounter = 0;