Bug Fixed and Not deleting logs with errors

This commit is contained in:
Luis Fernando Molina committed 2019-12-05 10:39:51 +01:00
1 parent b855bb3f26
commit 1d161dddc0
2 files changed
+15 -4

No files matched your search

+13 -2
View File
@@ -90,8 +90,19 @@ exports.newDebugLog = function newDebugLog() {
thisObject.bot.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)
fileStorage.deleteTextFile(thisObject.bot.devTeam, fileToDelete);
thisObject.bot.LOGS_TO_DELETE_QUEUE.splice(0, 1)
/* Will delete this file only if it does not contains ERROR inside. */
let fileContent = fileStorage.getTextFile(thisObject.bot.devTeam, fileToDelete, onGetFile, true)
function onGetFile(err, fileContent) {
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
if (fileContent.indexOf("ERROR") < 0) {
/* Logs will only be deleted when they contain no ERROR in them. */
fileStorage.deleteTextFile(thisObject.bot.devTeam, fileToDelete);
}
} else {
fileStorage.deleteTextFile(thisObject.bot.devTeam, fileToDelete);
}
}
}
function writeLog() {
+2 -2
View File
@@ -333,7 +333,7 @@
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
logger.write(MODULE_NAME, "[ERROR] start -> processTimePeriodsMarketFiles -> periodsLoopBody -> dependencyLoopBody -> getFile -> onFileReceived -> err = " + err.stack);
logger.write(MODULE_NAME, "[ERROR] start -> processTimePeriodsMarketFiles -> periodsLoopBody -> dependencyLoopBody -> getFile -> onFileReceived -> err = " + err.message);
callBackFunction(err);
return;
}
@@ -987,7 +987,7 @@
let dataRange = {
begin: pBegin.valueOf(),
end: pEnd.valueOf()
end: pEnd.valueOf() + ONE_DAY_IN_MILISECONDS
};
let fileContent = JSON.stringify(dataRange);