bugs fixed

This commit is contained in:
Luis Fernando Molina committed 2020-04-24 13:27:20 +02:00
1 parent 2c5bcefc39
commit fe537dff3b
4 files changed
+18 -5

No files matched your search

+3 -2
View File
@@ -105,10 +105,11 @@
}
function finalize() {
for (let i = 0; i < dataSetsModulesArray.length; i++) {
dataSetsModule = dataSetsModulesArray[i]
for (let i = 0; i < thisObject.dataSetsModulesArray.length; i++) {
let dataSetModule = thisObject.dataSetsModulesArray[i]
dataSetModule.finalize()
}
thisObject.dataSetsModulesArray = undefined
filter = undefined
bot = undefined
thisObject = undefined
+12 -2
View File
@@ -149,6 +149,7 @@ exports.newFileStorage = function newFileStorage(logger, host, port) {
} else {
logger.write(MODULE_NAME, '[WARN] FileStorage -> getTextFile -> onFileRead -> Could read the file, but could not parse it as it is not a valid JSON.')
logger.write(MODULE_NAME, '[WARN] FileStorage -> getTextFile -> onFileRead -> err = ' + err.stack)
logger.write(MODULE_NAME, '[WARN] FileStorage -> getTextFile -> onFileRead -> text.toString() = ' + text.toString())
setTimeout(retry, retryTimeToUse)
return
}
@@ -437,6 +438,9 @@ exports.newFileStorage = function newFileStorage(logger, host, port) {
function getFileViaHTTP(filePath, callback) {
try {
/* The filePath received is the one that is needed to fetch data from with fs. To do it via http we need to remove the prefix that includes this: ./Data-Storage/ */
filePath = filePath.substring(15, filePath.length)
let http = require('http');
let url = 'http://' + host +
':' + port +
@@ -458,8 +462,14 @@ exports.newFileStorage = function newFileStorage(logger, host, port) {
function onEnd() {
let fileContent = Buffer.concat(chunks).toString('utf8')
callback(null, fileContent)
let err = null
if (fileContent === 'The specified key does not exist.') {
err = {
code: "ENOENT" // This is how fs would have returned upon this situation.
}
fileContent = undefined
}
callback(err, fileContent)
}
}
+2 -1
View File
@@ -167,10 +167,11 @@
}
function finalize() {
statusReports.forEach(forEachStatusDependency)
thisObject.statusReports.forEach(forEachStatusDependency)
function forEachStatusDependency(statusDependency) {
statusDependency.finalize()
}
thisObject.statusReports = undefined
bot = undefined
thisObject = undefined
}
+1
View File
@@ -258,6 +258,7 @@
*/
logger.write(MODULE_NAME, "[ERROR] load -> onFileReceived -> Error Parsing the Status report. -> Err = " + err.message);
logger.write(MODULE_NAME, "[WARN] load -> onFileReceived -> Error Parsing the Status report. -> text = " + text);
let customFail = {
result: global.CUSTOM_FAIL_RESPONSE.result,