diff --git a/.vs/AACloud/v15/.suo b/.vs/AACloud/v15/.suo index 58e375e05..756c698bd 100644 Binary files a/.vs/AACloud/v15/.suo and b/.vs/AACloud/v15/.suo differ diff --git a/Dependencies.js b/Dependencies.js index 086003b69..214b3fe5a 100644 --- a/Dependencies.js +++ b/Dependencies.js @@ -118,7 +118,13 @@ loadCount++; - let key = pDependenciesConfig[i].devTeam + "-" + pDependenciesConfig[i].bot + "-" + pDependenciesConfig[i].process + "-" + pDependenciesConfig[i].dataSetVersion; + let key; + + if (pDependenciesConfig[i].dataSetSection === "Month") { + key = pDependenciesConfig[i].devTeam + "-" + pDependenciesConfig[i].bot + "-" + pDependenciesConfig[i].process + "-" + pDependenciesConfig[i].dataSetVersion + "-" + pYear + "-" + pMonth; + } else { + key = pDependenciesConfig[i].devTeam + "-" + pDependenciesConfig[i].bot + "-" + pDependenciesConfig[i].process + "-" + pDependenciesConfig[i].dataSetVersion; + } thisObject.statusReports.set(key, statusReportModule); diff --git a/Extraction Bot Main Loop.js b/Extraction Bot Main Loop.js index 8fce769a2..819c5361e 100644 --- a/Extraction Bot Main Loop.js +++ b/Extraction Bot Main Loop.js @@ -159,20 +159,54 @@ loopControl(nextWaitTime); return; } - break; case global.DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time. logger.write("[ERROR] run -> loop -> startUserBot -> onFinished > Retry Later. Requesting Execution Retry."); nextWaitTime = 'Retry'; loopControl(nextWaitTime); return; } - break; case global.DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle. logger.write("[ERROR] run -> loop -> startUserBot -> onFinished > Operation Failed. Aborting the process."); callBackFunction(err); return; } - break; + case global.CUSTOM_OK_RESPONSE.result: { + + switch (err.message) { + case "Dependency does not exist.": { + logger.write("[WARN] run -> loop -> startUserBot -> onFinished > Dependency does not exist. This Loop will go to sleep."); + nextWaitTime = 'Sleep'; + loopControl(nextWaitTime); + return; + } + case "Dependency not ready.": { + logger.write("[WARN] run -> loop -> startUserBot -> onFinished > Dependency not ready. This Loop will go to sleep."); + nextWaitTime = 'Sleep'; + loopControl(nextWaitTime); + return; + } + case "Month before it is needed.": { + logger.write("[WARN] run -> loop -> startUserBot -> onFinished > Month before it is needed. This Loop will be terminated."); + callBackFunction(global.DEFAULT_OK_RESPONSE); + return; + } + case "Month fully processed.": { + logger.write("[WARN] run -> loop -> startUserBot -> onFinished > Month fully processed. This Loop will be terminated."); + callBackFunction(global.DEFAULT_OK_RESPONSE); + return; + } + case "End of the month reached.": { + logger.write("[WARN] run -> loop -> startUserBot -> onFinished > End of the month reached. This Loop will be terminated."); + callBackFunction(global.DEFAULT_OK_RESPONSE); + return; + } + default: { + logger.write("[ERROR] run -> loop -> startUserBot -> onFinished > Unhandled custom response received. -> err.message = " + err.message); + callBackFunction(err); + return; + } + } + } } } } @@ -202,7 +236,7 @@ switch (nextWaitTime) { case 'Normal': { if (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Restarting Loop in " + (processConfig.executionWaitTime / 1000) + " seconds."); } - setTimeout(loop, processConfig.executionWaitTime); + setTimeout(loop, processConfig.normalWaitTime); } break; case 'Retry': { @@ -210,6 +244,11 @@ setTimeout(loop, processConfig.retryWaitTime); } break; + case 'Sleep': { + if (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Restarting Loop in " + (processConfig.retryWaitTime / 60000) + " minutes."); } + setTimeout(loop, processConfig.sleepWaitTime); + } + break; } } diff --git a/Indicator Bot Main Loop.js b/Indicator Bot Main Loop.js index 09042037c..cebe3fe43 100644 --- a/Indicator Bot Main Loop.js +++ b/Indicator Bot Main Loop.js @@ -206,6 +206,11 @@ setTimeout(loop, processConfig.retryWaitTime); } break; + case 'Sleep': { + if (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Restarting Loop in " + (processConfig.retryWaitTime / 60000) + " minutes."); } + setTimeout(loop, processConfig.sleepWaitTime); + } + break; } } diff --git a/Status Report.js b/Status Report.js index 9227fdf39..5e1654300 100644 --- a/Status Report.js +++ b/Status Report.js @@ -117,7 +117,7 @@ result: global.CUSTOM_OK_RESPONSE.result, message: "Status Report was never created." } - logger.write("[WARN] initialize -> load -> onFileReceived -> customOK = " + err.message); + logger.write("[WARN] initialize -> load -> onFileReceived -> customOK = " + customOK.message); callBackFunction(customOK); return; } diff --git a/Trading Bot Main Loop.js b/Trading Bot Main Loop.js index 5404743f6..78b56dd6a 100644 --- a/Trading Bot Main Loop.js +++ b/Trading Bot Main Loop.js @@ -368,6 +368,11 @@ setTimeout(loop, processConfig.retryWaitTime); } break; + case 'Sleep': { + if (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Restarting Loop in " + (processConfig.retryWaitTime / 60000) + " minutes."); } + setTimeout(loop, processConfig.sleepWaitTime); + } + break; } }