API Data Fetcher bot process improved

This commit is contained in:
Luis Fernando Molina committed 2021-05-19 22:38:11 +02:00
1 parent 232b2ef63c
commit afc81903c5
5 files changed
+278 -256

No files matched your search

@@ -35,6 +35,7 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
let thisReport // This holds the status report.
let processNode // This hold the node Process Definition
let lastPage = {} // This holds the last page fetched for each endpoint
let contextVariables = {}
getContextVariables()
startProcess()
@@ -647,6 +648,9 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
TS.projects.superalgos.utilities.miscellaneousFunctions.pad(file.month, 2) + '/' +
TS.projects.superalgos.utilities.miscellaneousFunctions.pad(file.day, 2)
/* We will need to save this at the Status Report */
contextVariables.lastFile = file.date
await readDatasetFile("/" + dateForPath)
appendToExistingDataset()
await saveDatasetFile("/" + dateForPath)
@@ -828,9 +832,15 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
try {
thisReport.file = {
lastRun: (new Date()).toISOString(),
lastPage: lastPage
};
thisReport.save(onSaved);
lastPage: lastPage,
lastFile: contextVariables.lastFile.toISOString()
}
if (thisReport.file.beginingOfMarket === undefined) {
thisReport.file.beginingOfMarket = (new Date()).toISOString()
}
thisReport.save(onSaved)
function onSaved(err) {
if (err.result !== TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE.result) {