StatusDependencies
This commit is contained in:
1 parent
4530630d35
commit
5e2ea94af9
4 files changed
+22
-22
No files matched your search
Binary file not shown.
@@ -32,18 +32,18 @@
|
||||
let year;
|
||||
let month;
|
||||
|
||||
let dependencies;
|
||||
let statusDependencies;
|
||||
|
||||
return thisObject;
|
||||
|
||||
function initialize(pDependencies, pMonth, pYear, callBackFunction) {
|
||||
function initialize(pStatusDependencies, pMonth, pYear, callBackFunction) {
|
||||
|
||||
try {
|
||||
|
||||
year = pYear;
|
||||
month = pMonth;
|
||||
month = utilities.pad(month, 2); // Adding a left zero when needed.
|
||||
dependencies = pDependencies;
|
||||
statusDependencies = pStatusDependencies;
|
||||
|
||||
logger.fileName = MODULE_NAME + "-" + year + "-" + month;
|
||||
|
||||
@@ -189,13 +189,13 @@ What is the lastFile pointer?
|
||||
reportKey = "AAMasters" + "-" + "AACharly" + "-" + "Poloniex-Live-Trades" + "-" + "dataSet.V1";
|
||||
if (FULL_LOG === true) { logger.write("[INFO] start -> getContextVariables -> reportKey = " + reportKey); }
|
||||
|
||||
if (dependencies.statusReports.get(reportKey).status === "Status Report is corrupt.") {
|
||||
if (statusDependencies.statusReports.get(reportKey).status === "Status Report is corrupt.") {
|
||||
logger.write("[ERROR] start -> getContextVariables -> Can not continue because dependecy Status Report is corrupt. ");
|
||||
callBackFunction(global.DEFAULT_RETRY_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
thisReport = dependencies.statusReports.get(reportKey).file;
|
||||
thisReport = statusDependencies.statusReports.get(reportKey).file;
|
||||
|
||||
if (thisReport.lastFile === undefined) {
|
||||
logger.write("[WARN] start -> getContextVariables -> Undefined Last File. -> reportKey = " + reportKey);
|
||||
@@ -214,13 +214,13 @@ What is the lastFile pointer?
|
||||
reportKey = "AAMasters" + "-" + "AACharly" + "-" + "Poloniex-Historic-Trades" + "-" + "dataSet.V1";
|
||||
if (FULL_LOG === true) { logger.write("[INFO] start -> getContextVariables -> reportKey = " + reportKey); }
|
||||
|
||||
if (dependencies.statusReports.get(reportKey).status === "Status Report is corrupt.") {
|
||||
if (statusDependencies.statusReports.get(reportKey).status === "Status Report is corrupt.") {
|
||||
logger.write("[ERROR] start -> getContextVariables -> Can not continue because dependecy Status Report is corrupt. ");
|
||||
callBackFunction(global.DEFAULT_RETRY_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
thisReport = dependencies.statusReports.get(reportKey).file;
|
||||
thisReport = statusDependencies.statusReports.get(reportKey).file;
|
||||
|
||||
if (thisReport.lastFile === undefined) {
|
||||
logger.write("[WARN] start -> getContextVariables -> Undefined Last File. -> reportKey = " + reportKey);
|
||||
@@ -271,13 +271,13 @@ What is the lastFile pointer?
|
||||
reportKey = "AAMasters" + "-" + "AACharly" + "-" + "Poloniex-Hole-Fixing" + "-" + "dataSet.V1" + "-" + year + "-" + month;
|
||||
if (FULL_LOG === true) { logger.write("[INFO] start -> getContextVariables -> reportKey = " + reportKey); }
|
||||
|
||||
if (dependencies.statusReports.get(reportKey).status === "Status Report is corrupt.") {
|
||||
if (statusDependencies.statusReports.get(reportKey).status === "Status Report is corrupt.") {
|
||||
logger.write("[ERROR] start -> getContextVariables -> Can not continue because self dependecy Status Report is corrupt. Aborting Process.");
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
holeFixingStatusReport = dependencies.statusReports.get(reportKey).file;
|
||||
holeFixingStatusReport = statusDependencies.statusReports.get(reportKey).file;
|
||||
|
||||
if (holeFixingStatusReport.lastFile === undefined) {
|
||||
|
||||
@@ -340,8 +340,8 @@ What is the lastFile pointer?
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] start -> getContextVariables -> err = " + err.message);
|
||||
if (err.message === "Cannot read property 'file' of undefined") {
|
||||
logger.write("[HINT] start -> getContextVariables -> Check the bot configuration to see if all of its dependencies declarations are correct. ");
|
||||
logger.write("[HINT] start -> getContextVariables -> Dependencies loaded -> keys = " + JSON.stringify(dependencies.keys));
|
||||
logger.write("[HINT] start -> getContextVariables -> Check the bot configuration to see if all of its statusDependencies declarations are correct. ");
|
||||
logger.write("[HINT] start -> getContextVariables -> Dependencies loaded -> keys = " + JSON.stringify(statusDependencies.keys));
|
||||
}
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
@@ -1185,7 +1185,7 @@ What is the lastFile pointer?
|
||||
*/
|
||||
|
||||
let key = bot.devTeam + "-" + bot.codeName + "-" + bot.process + "-" + bot.dataSetVersion + "-" + year + "-" + month;
|
||||
let statusReport = dependencies.statusReports.get(key);
|
||||
let statusReport = statusDependencies.statusReports.get(key);
|
||||
|
||||
if (lastTradeId === undefined) {
|
||||
|
||||
@@ -1266,7 +1266,7 @@ What is the lastFile pointer?
|
||||
if (monthChecked === true) {
|
||||
|
||||
let key = bot.devTeam + "-" + bot.codeName + "-" + bot.process + "-" + bot.dataSetVersion;
|
||||
let statusReport = dependencies.statusReports.get(key);
|
||||
let statusReport = statusDependencies.statusReports.get(key);
|
||||
statusReport.verifyMarketComplete(callBack);
|
||||
return;
|
||||
|
||||
@@ -1281,7 +1281,7 @@ What is the lastFile pointer?
|
||||
if (monthChecked === true) {
|
||||
|
||||
let key = bot.devTeam + "-" + bot.codeName + "-" + bot.process + "-" + bot.dataSetVersion;
|
||||
let statusReport = dependencies.statusReports.get(key);
|
||||
let statusReport = statusDependencies.statusReports.get(key);
|
||||
statusReport.verifyMarketComplete(callBack);
|
||||
return;
|
||||
|
||||
@@ -1306,7 +1306,7 @@ What is the lastFile pointer?
|
||||
|
||||
let key = bot.devTeam + "-" + bot.codeName + "-" + bot.process + "-" + bot.dataSetVersion;
|
||||
|
||||
let statusReport = dependencies.statusReports.get(key);
|
||||
let statusReport = statusDependencies.statusReports.get(key);
|
||||
|
||||
let lastFileWithoutHoles = new Date(lastTradeDatetime.valueOf() - 60 * 1000); // It is the previous file where the last verified trade is.
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
let utilities = UTILITIES.newUtilities(bot);
|
||||
let poloniexApiClient = new POLONIEX_CLIENT_MODULE();
|
||||
|
||||
let dependencies;
|
||||
let statusDependencies;
|
||||
|
||||
return thisObject;
|
||||
|
||||
function initialize(pDependencies, pMonth, pYear, callBackFunction) {
|
||||
function initialize(pStatusDependencies, pMonth, pYear, callBackFunction) {
|
||||
|
||||
try {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
|
||||
dependencies = pDependencies;
|
||||
statusDependencies = pStatusDependencies;
|
||||
|
||||
charlyStorage.initialize({ bot: "AACharly", devTeam: "AAMasters" }, onCharlyInizialized);
|
||||
|
||||
@@ -384,7 +384,7 @@ Array of records with this information:
|
||||
|
||||
let key = bot.devTeam + "-" + bot.codeName + "-" + bot.process + "-" + bot.dataSetVersion;
|
||||
|
||||
let statusReport = dependencies.statusReports.get(key);
|
||||
let statusReport = statusDependencies.statusReports.get(key);
|
||||
|
||||
statusReport.file = {
|
||||
firstFile: { // This date points to the file that might be incomplete.
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
"retryWaitTime": 10000,
|
||||
"sleepWaitTime": 3600000,
|
||||
"comaWaitTime": 86400000,
|
||||
"dependencies": [
|
||||
"statusDependencies": [
|
||||
{
|
||||
"devTeam": "AAMasters",
|
||||
"bot": "AACharly",
|
||||
@@ -67,7 +67,7 @@
|
||||
"retryWaitTime": 10000,
|
||||
"sleepWaitTime": 3600000,
|
||||
"comaWaitTime": 86400000,
|
||||
"dependencies": [
|
||||
"statusDependencies": [
|
||||
{
|
||||
"devTeam": "AAMasters",
|
||||
"bot": "AACharly",
|
||||
@@ -112,7 +112,7 @@
|
||||
"retryWaitTime": 10000,
|
||||
"sleepWaitTime": 3600000,
|
||||
"comaWaitTime": 86400000,
|
||||
"dependencies": [
|
||||
"statusDependencies": [
|
||||
{
|
||||
"devTeam": "AAMasters",
|
||||
"bot": "AACharly",
|
||||
|
||||
Reference in new issue
Block a user