diff --git a/.vs/AACloud/v15/.suo b/.vs/AACloud/v15/.suo index 4542d9560..0ce3cd83d 100644 Binary files a/.vs/AACloud/v15/.suo and b/.vs/AACloud/v15/.suo differ diff --git a/Debug Log.js b/Debug Log.js index 5d79870a5..1072adb35 100644 --- a/Debug Log.js +++ b/Debug Log.js @@ -59,14 +59,8 @@ try { - var rimraf = require('rimraf'); - let folderToRemove = '../Logs/' + thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName + "." + thisObject.bot.version.major + "." + thisObject.bot.version.minor + "/" + thisObject.bot.process + "/Loop." + (loopCounter + 1).toString(); - /* We remove the folder in case it exister from before, so that all its content is gone. */ - - //rimraf.sync(folderToRemove); - /* We create the new one. */ folderPath = '../Logs/' + thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName + "." + thisObject.bot.version.major + "." + thisObject.bot.version.minor + "/" + thisObject.bot.process + "/Loop." + loopCounter; @@ -77,7 +71,7 @@ folderToRemove = '../Logs/' + thisObject.bot.devTeam + "/" + thisObject.bot.type + "/" + thisObject.bot.codeName + "." + thisObject.bot.version.major + "." + thisObject.bot.version.minor + "/" + thisObject.bot.process + "/Loop." + (loopCounter - global.PLATFORM_CONFIG.maxLogLoops).toString(); - rimraf.sync(folderToRemove); + deleteLoopFolder(folderToRemove); if (thisObject.bot.debug.year !== undefined) { @@ -195,5 +189,60 @@ return str.length < max ? pad("0" + str, max) : str; } + function deleteLoopFolder(pFolderPath) { + + let rimraf = require('rimraf'); + let fs = require('fs'); + let errosFound = false; + + try { + + let fileCount; + let filesChecked = 0; + + fs.readdir(pFolderPath, onfileCount); + + function onfileCount(err, files) { + + if (err) { return;} + + fileCount = files.length; + + fs.readdirSync(pFolderPath).forEach(fileName => { + + fs.readFile(pFolderPath + "/" + fileName, onFileRead); + + function onFileRead(err, file) { + + try { + + filesChecked++; + + if (file.indexOf("[ERROR]") > 0) { + + errosFound = true; + + } + + if (filesChecked === fileCount) { + + if (errosFound === false) { + + rimraf.sync(pFolderPath); + + } + } + } + catch (err) { + console.log("Error trying to delete Loop Folder " + pFolderPath + ".Reading file " + fileName + ". err.message = " + err.message); + } + } + }) + } + } + catch (err) { + return; + } + } }; diff --git a/this.config.json b/this.config.json index 2c86886bb..46d13bf94 100644 --- a/this.config.json +++ b/this.config.json @@ -27,13 +27,18 @@ "process": "One-Min-Daily-Candles-Volumes" }, { - "enabled": "true", + "enabled": "false", "botPath": "../Bots/AAMasters/AACharly-Extraction-Bot", "process": "Poloniex-Hole-Fixing" + }, + { + "enabled": "true", + "botPath": "../Bots/AAMasters/AACharly-Extraction-Bot", + "process": "Poloniex-Live-Trades" } ], - "stopGracefully": "true", + "stopGracefully": "false", "exchangeSimulationMode": "false", - "storageConnStringFolder": "Production", - "maxLogLoops": 10 + "storageConnStringFolder": "Testnet", + "maxLogLoops": 5 } \ No newline at end of file