From 5e2ea94af9a225520a8d3ccfae56358dfaaf6844 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 15 Apr 2018 10:14:41 +0200 Subject: [PATCH] StatusDependencies --- .vs/AACharly-Extraction-Bot/v15/.suo | Bin 32768 -> 33280 bytes Poloniex-Hole-Fixing/User.bot.js | 30 +++++++++++++-------------- Poloniex-Live-Trades/User.bot.js | 8 +++---- this.bot.config.json | 6 +++--- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.vs/AACharly-Extraction-Bot/v15/.suo b/.vs/AACharly-Extraction-Bot/v15/.suo index edce816ae0114975ee480a0078860b1acd0ff6c2..3edc1158f5377e3755b99256f321e967797cf0eb 100644 GIT binary patch delta 1023 zcma))Ur5tY6vyxV?YDF?-TbquwW;JElu{RJWX)Xk$EDedXyuAn=$t}MCAYba*e?`< z2x`9rJqdyKEX?~7ggDS1g1}@wo~E*JE8qRj|04D#NlW<(goFrv2q|HTN)S>-Xc$te z&xOZv3AKN$6R28=xpQUV9NhzJLY21c?G%Sp{sYpZ)nc}K8v$!IHJqBGfT;cvbL-{2 zBg~q&LSt?*J1m%>A@CPO=_I7|4lSO7sIn13@avSUEm0a|{=%S2%MZz&_Y7Z4s&e_n z&L>rdXV6-r7bTpqkA~|avlm4uEboh}yD+s0A=7u-0e-VX%TJn*IXVO0k!wbq5BUBz?&?7fW60}aMu`TQkHfI2#vM;lFs|E=&hUW7GQp?Tu1SF(bG0; z;|dA4ma&BEp75V~SSnLbb|zt_e=!a3b9o`^tB2^A28-zC5(C15SEBH#ziB(CnUjVn zBt|Y8joVcT*;uN>_yGDT-axrLn1Cf;4YPPJWJ?Wc>8p{`My)!d-B>bV+>(*j!d+J< zi~0gIXFul3@f8nwA3)`JDSI;3LF)@LI;>fN@m_TP+xS=EcDTLC!bkWvau7Dh^hZMf#OGXH^`aLddmGe$kfVk{;q4qUnqXki;a)E1dp^(SJm=o4E>Tsb z1&@o8jbSB(UqsB;bzK*!gbBlu=a-hCNUvK8$6v+dN(G#JLB=f2K>=&@4m`%JlmiuO z(iiaYg4PC^6Mn23^&&k3O}LkKSgcPk*iZ7}jxCBuamdjl1dTcjvZ}EOiYD*Qhny6B ztTVr94eF=nUJ5rb-JFLk)|wRy;goLXxOn12wgd~n>LJa@CRo1e1}0yy8`$|^1uMAxz-HZlkT6O z77#|Mu2D=m0>9E7bt(ILP=(DKcIU-r-ODXz3kUaYg8L>~`B6vCGSsHt;xpwOIs%8d z@7S>4gMnZ_lLHxQN+++*TujcyWAmk918SEmI2OEzALC98#odTk!lhA)<53rWPTDba z-i^D$vrL=1D_-^X-CKxX3sYGOQ?w;|@Ybx4twzS6tVRJ>t||Cn?r1Th{cUXsKP2q* z)Jq%>s-iO%OZG#f_%+;wU^Q}IoPdSm1Hi#9e4jY5ZCHEj12#PqMDKMNp6}=-!4h`$=m*4ZV$Eo1Ov))O8@`> diff --git a/Poloniex-Hole-Fixing/User.bot.js b/Poloniex-Hole-Fixing/User.bot.js index b978cb859..dc1651234 100644 --- a/Poloniex-Hole-Fixing/User.bot.js +++ b/Poloniex-Hole-Fixing/User.bot.js @@ -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. diff --git a/Poloniex-Live-Trades/User.bot.js b/Poloniex-Live-Trades/User.bot.js index 2b50c2fbd..919ca38d2 100644 --- a/Poloniex-Live-Trades/User.bot.js +++ b/Poloniex-Live-Trades/User.bot.js @@ -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. diff --git a/this.bot.config.json b/this.bot.config.json index 947aadaa6..52578e37a 100644 --- a/this.bot.config.json +++ b/this.bot.config.json @@ -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",