From 296912cdb9b60f28340d602a1e75c440328adeea Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 18 Mar 2018 21:39:14 +0100 Subject: [PATCH] Months Reports need to specify the datetime at the key - Untested --- .vs/AACloud/v15/.suo | Bin 68608 -> 83456 bytes Dependencies.js | 8 +++++- Extraction Bot Main Loop.js | 47 +++++++++++++++++++++++++++++++++--- Indicator Bot Main Loop.js | 5 ++++ Status Report.js | 2 +- Trading Bot Main Loop.js | 5 ++++ 6 files changed, 61 insertions(+), 6 deletions(-) diff --git a/.vs/AACloud/v15/.suo b/.vs/AACloud/v15/.suo index 58e375e057c7625a32b4ebdf5d2e20a30b90e3d2..756c698bdd9fee132496ec170228e84a30d6092c 100644 GIT binary patch delta 2273 zcmeH{e^69a6vyAayj}LeF73*%B@h=7BbLD>@)tD)?ds4}8p%*;lVI!&Fa}J!Xwi(K zSz4099)BQe!qY#@vViv=)6iCqQ!_ch@M9W@(8m67#wjVZnFgWn#kUSQYUT82clR^r z+;i_c_ndRjdkrmeL!+U|MXrEiw@MQJQW%(;o}Pw~7)a?XO5&F8WfQ;m46tW~^?9o2 z^=yH5mFKd8r7%PRJTV;sIR|8bhjm+`F7qIt015hB?0*3IZmN_MJ|PFiZHpf<(Mrkcy*sn1|$Z#NgE1^9-jz6#T25#n;}4~0lq z`6`o$t`Jb$`V?~UNP0c|@Z4M&LG}GkOf>|AxH*xkOp$Vhd|_JqqC-uly%TbK@DwHmY77vYcZps;xLGbLO&^5 ztk6Ou6Sv_6$Xv6$2xSded&58hvzy$O99BS?shvu-K;PiFXB%MxtOygNoOih-% z;y5RswL<2z;vj!kufjxr;j^roKfO^7*x|=@K1|JyYc7k~@($K_fSur7@E+I&8o~Qu zrecsypcw=JfxTcK*bfeX7H|->f4&n3v35! zbI~T#F(}6YHD$)Iiq4|7Of8fHo)dQADCBW{sIzTBS>&fYjrObg8)TS%uy z?QyBd=*CD7E`l;2cy0zG613gt@z#2)%e~dFRC;|l>mhL#E$~LOn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U#gWn6C-5&LG8zmQ<;%Lv5H3-C9{xcZo*t&Q8 zn)T<<)1j-?uGXVY3V!;eBce3>niTiwNTcHRHhCj%pQ0%4-QMu1qC}b_K3|yJ-+o^# z4&h7*=z*VpnRly;vicEMm$>>dzb!dq7}*Q|PL4PlR!YI_l8xE$pzZQ<7SKWQOLipE YN>d*=>B_m)7g}rBAEg%@ZR|4p6G(2qg#Z8m 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; } }