diff --git a/.vs/AAWeb/v15/.suo b/.vs/AAWeb/v15/.suo index 532e5d610..f2374a705 100644 Binary files a/.vs/AAWeb/v15/.suo and b/.vs/AAWeb/v15/.suo differ diff --git a/Files/File.js b/Files/File.js index ed3aa34a7..3ef68497a 100644 --- a/Files/File.js +++ b/Files/File.js @@ -78,7 +78,7 @@ function newFile() { file = pFile; - callBackFunction(); + callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE); } catch (err) { diff --git a/Files/FileCache.js b/Files/FileCache.js index e5386b403..b04fbec6a 100644 --- a/Files/FileCache.js +++ b/Files/FileCache.js @@ -90,7 +90,7 @@ function newFileCache() { filesLoaded++; - callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE); // Note that the callback is called for every file loaded. + callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE, thisObject); // Note that the callback is called for every file loaded. } } diff --git a/Files/FileCursorCache.js b/Files/FileCursorCache.js index 94ce52b6d..30e6fd6a9 100644 --- a/Files/FileCursorCache.js +++ b/Files/FileCursorCache.js @@ -101,7 +101,7 @@ function newFileCursorCache() { } filesLoaded++; - callBackWhenFileReceived(GLOBAL.DEFAULT_OK_RESPONSE); // Note that the call back is called for every file loaded at each cursor. + callBackWhenFileReceived(GLOBAL.DEFAULT_OK_RESPONSE, thisObject); // Note that the call back is called for every file loaded at each cursor. } diff --git a/Files/FileSequence.js b/Files/FileSequence.js index f79449d86..ffa28cb6c 100644 --- a/Files/FileSequence.js +++ b/Files/FileSequence.js @@ -133,7 +133,7 @@ function newFileSequence() { filesLoaded++; - callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE); // Note that the callback is called for every file loaded. + callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE, thisObject); // Note that the callback is called for every file loaded. } } diff --git a/ProductStorage.js b/ProductStorage.js index f4b3ef26b..9dde69f23 100644 --- a/ProductStorage.js +++ b/ProductStorage.js @@ -29,10 +29,10 @@ function newProductStorage(pName) { let thisObject = { - fileCache: undefined, - fileCursorCache: undefined, - file: undefined, - fileSequence: undefined, + fileCache: [], + fileCursorCache: [], + file: [], + fileSequence: [], setDatetime: setDatetime, setTimePeriod: setTimePeriod, @@ -75,8 +75,9 @@ function newProductStorage(pName) { if (INFO_LOG === true) { logger.write("[INFO] initialize -> Market Files -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); } - thisObject.fileCache = newFileCache(); - thisObject.fileCache.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, onCacheFileReady); + let fileCache = newFileCache(); + fileCache.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, onCacheFileReady); + thisObject.fileCache.push(fileCache); dataSetsToLoad++; } break; @@ -85,8 +86,9 @@ function newProductStorage(pName) { if (INFO_LOG === true) { logger.write("[INFO] initialize -> Daily Files -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); } - thisObject.fileCursorCache = newFileCursorCache(); - thisObject.fileCursorCache.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, pDatetime, pTimePeriod, onFileCursorReady); + let fileCursorCache = newFileCursorCache(); + fileCursorCache.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, pDatetime, pTimePeriod, onFileCursorReady); + thisObject.fileCursorCache.push(fileCursorCache); dataSetsToLoad++; } break; @@ -95,8 +97,9 @@ function newProductStorage(pName) { if (INFO_LOG === true) { logger.write("[INFO] initialize -> Single File -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); } - thisObject.file = newFile(); - thisObject.file.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, onSingleFileReady); + let file = newFile(); + file.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, onSingleFileReady); + thisObject.file.push(file); dataSetsToLoad++; } break; @@ -105,14 +108,15 @@ function newProductStorage(pName) { if (INFO_LOG === true) { logger.write("[INFO] initialize -> File Sequence -> key = " + pDevTeam.codeName + "-" + pBot.codeName + "-" + pProduct.codeName); } - thisObject.fileSequence = newFileSequence(); - thisObject.fileSequence.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, onFileSequenceReady); + let fileSequence = newFileSequence(); + fileSequence.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, onFileSequenceReady); + thisObject.fileSequence.push(fileSequence); dataSetsToLoad++; } break; } - function onCacheFileReady(err) { + function onCacheFileReady(err, pCaller) { try { @@ -151,8 +155,8 @@ function newProductStorage(pName) { } let event = { - totalValue: thisObject.fileCache.getExpectedFiles(), - currentValue: thisObject.fileCache.getFilesLoaded() + totalValue: pCaller.getExpectedFiles(), + currentValue: pCaller.getFilesLoaded() } thisObject.eventHandler.raiseEvent('Market File Loaded', event); @@ -171,7 +175,7 @@ function newProductStorage(pName) { } } - function onFileCursorReady(err) { + function onFileCursorReady(err, pCaller) { try { @@ -210,8 +214,8 @@ function newProductStorage(pName) { } let event = { - totalValue: thisObject.fileCursorCache.getExpectedFiles(), - currentValue: thisObject.fileCursorCache.getFilesLoaded() + totalValue: pCaller.getExpectedFiles(), + currentValue: pCaller.getFilesLoaded() } thisObject.eventHandler.raiseEvent('Daily File Loaded', event); @@ -230,7 +234,7 @@ function newProductStorage(pName) { } } - function onSingleFileReady(err) { + function onSingleFileReady(err, pCaller) { try { @@ -289,7 +293,7 @@ function newProductStorage(pName) { } } - function onFileSequenceReady(err) { + function onFileSequenceReady(err, pCaller) { try { @@ -328,8 +332,8 @@ function newProductStorage(pName) { } let event = { - totalValue: thisObject.fileSequence.getExpectedFiles(), - currentValue: thisObject.fileSequence.getFilesLoaded() + totalValue: pCaller.getExpectedFiles(), + currentValue: pCaller.getFilesLoaded() } thisObject.eventHandler.raiseEvent('File Sequence Loaded', event); @@ -391,8 +395,10 @@ function newProductStorage(pName) { if (timePeriod <= _1_HOUR_IN_MILISECONDS) { - thisObject.fileCursorCache.setDatetime(pDatetime); + for (let i = 0; i < thisObject.fileCursorCache.length; i++) { + thisObject.fileCursorCache[i].setDatetime(pDatetime); + } } } @@ -410,9 +416,9 @@ function newProductStorage(pName) { if (timePeriod <= _1_HOUR_IN_MILISECONDS) { - if (thisObject.fileCursorCache !== undefined) { + for (let i = 0; i < thisObject.fileCursorCache.length; i++) { - thisObject.fileCursorCache.setTimePeriod(pTimePeriod, datetime); + thisObject.fileCursorCache[i].setTimePeriod(pTimePeriod, datetime); } } } diff --git a/server.js b/server.js index 1cf8bb361..330817bd6 100644 --- a/server.js +++ b/server.js @@ -6,7 +6,7 @@ if (CONSOLE_LOG === true) { } -const DEBUG_MODE = false; // This forces the server to read Plotters from the local drive. +const DEBUG_MODE = true; // This forces the server to read Plotters from the local drive. if (CONSOLE_LOG === true && DEBUG_MODE === true) {