Merge pull request #40 from AAMasters/develop
Beta 6 Implementation Finished
This commit is contained in:
2 files changed
+20
-17
No files matched your search
+4
-4
@@ -1,4 +1,4 @@
|
||||
function newFileStorage (host, port) {
|
||||
function newFileStorage(host, port) {
|
||||
const MODULE_NAME = 'File Storage'
|
||||
const INFO_LOG = false
|
||||
const logger = newWebDebugLog()
|
||||
@@ -28,11 +28,11 @@ function newFileStorage (host, port) {
|
||||
}
|
||||
|
||||
if (host === '' || host === undefined) { host = 'localhost' }
|
||||
if (port === '' || port === undefined) { port = '34247' }
|
||||
if (port === '' || port === undefined) { port = '34248' }
|
||||
|
||||
return thisObject
|
||||
|
||||
async function getFileFromHost (filePath, callBackFunction, pathComplete) {
|
||||
async function getFileFromHost(filePath, callBackFunction, pathComplete) {
|
||||
try {
|
||||
if (INFO_LOG === true) { logger.write('[INFO] getFileFromHost -> Entering function.') }
|
||||
|
||||
@@ -67,7 +67,7 @@ function newFileStorage (host, port) {
|
||||
}
|
||||
}
|
||||
|
||||
function verifyRetry (errorCode) {
|
||||
function verifyRetry(errorCode) {
|
||||
for (let i = 0; i < recoverableErrors.length; i++) {
|
||||
const error = recoverableErrors[i]
|
||||
if (error === errorCode) {
|
||||
|
||||
+16
-13
@@ -145,10 +145,11 @@ function newMarketFiles () {
|
||||
}
|
||||
}
|
||||
|
||||
function updateFiles () {
|
||||
function updateFiles (message) {
|
||||
try {
|
||||
if (finalized === true) { return }
|
||||
let updatedFiles = 0
|
||||
if (message.event === undefined) { return }
|
||||
|
||||
/* Now we will get the market files */
|
||||
|
||||
@@ -156,21 +157,23 @@ function newMarketFiles () {
|
||||
let periodTime = marketFilesPeriods[i][0]
|
||||
let periodName = marketFilesPeriods[i][1]
|
||||
|
||||
if (dataset.config.validTimeFrames.includes(periodName) === true) {
|
||||
fileCloud.getFile(dataMine, bot, session, product, dataset, exchange, market, periodName, undefined, undefined, undefined, onFileReceived)
|
||||
if (dataset.config.validTimeFrames.includes(periodName) !== true) { continue }
|
||||
if (message.event.timeFrames !== undefined) {
|
||||
if (message.event.timeFrames.includes(periodName) !== true) { continue }
|
||||
}
|
||||
fileCloud.getFile(dataMine, bot, session, product, dataset, exchange, market, periodName, undefined, undefined, undefined, onFileReceived)
|
||||
|
||||
function onFileReceived (err, file) {
|
||||
try {
|
||||
if (finalized === true) { return }
|
||||
files.set(periodTime, file)
|
||||
updatedFiles++
|
||||
function onFileReceived (err, file) {
|
||||
try {
|
||||
if (finalized === true) { return }
|
||||
files.set(periodTime, file)
|
||||
updatedFiles++
|
||||
|
||||
if (updatedFiles === marketFilesPeriods.length) {
|
||||
thisObject.eventHandler.raiseEvent('Files Updated')
|
||||
}
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] updateFiles -> onFileReceived -> err = ' + err.stack) }
|
||||
if (updatedFiles === marketFilesPeriods.length) {
|
||||
thisObject.eventHandler.raiseEvent('Files Updated')
|
||||
}
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] updateFiles -> onFileReceived -> err = ' + err.stack) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user