diff --git a/config.js b/config.js index b398143..dd07372 100644 --- a/config.js +++ b/config.js @@ -1,6 +1,6 @@ var config = {} -config.debug = true; +config.debug = false; // Given how frequently pools fail, we need at least some caching... config.cache = { diff --git a/package.json b/package.json index bfde6b6..be757b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Hasher", - "version": "0.1.8-alpha.1", + "version": "0.1.9-alpha.2", "description": "A simple yet comprehensive interface that benchmarks your hardware, downloads and run miners for you to effectively mine the most profitable coin on the most profitable pool.", "main": "main.js", "scripts": { diff --git a/template/js/index.js b/template/js/index.js index dcd471a..7c0253f 100644 --- a/template/js/index.js +++ b/template/js/index.js @@ -114,7 +114,8 @@ function checkProfit(callback) { coin_unit = pool.coin_unit[algo]; } profit = hr / coin_unit * mp[estimate] * pool.profit_multiplier; - if(instructions === undefined || profit > instructions.profit) { + // For switching we need more than 5% better profit + if(instructions === undefined || profit > instructions.profit) { // Should smooth a bit here instructions = mp; instructions.alias = miner_alias; instructions.algo = algo; @@ -233,6 +234,9 @@ function startMining(instructions, donate){ $("#est_cur").html(``); $(".menu").prop( "disabled", false ); if(relaunch.do == true) { + if(relaunch.reset) { + mining = {}; // Resets the timer + } startMining(relaunch.inst, relaunch.donate); } }); @@ -256,6 +260,7 @@ function startMining(instructions, donate){ relaunch.do = true; relaunch.inst = new_instructions; relaunch.donate = false; + relaunch.reset = false; mining.process.kill(); } // It's been 10hrs @@ -264,7 +269,7 @@ function startMining(instructions, donate){ relaunch.do = true; relaunch.inst = instructions; relaunch.donate = true; - mining = {}; // Resets the timer so we can know donation time + relaunch.reset = true; mining.process.kill(); } }); @@ -276,7 +281,7 @@ function startMining(instructions, donate){ relaunch.do = true; relaunch.inst = instructions; relaunch.donate = false; - mining = {}; // Resets the timer for another 10hrs + relaunch.reset = true; mining.process.kill(); } } diff --git a/template/js/performance.js b/template/js/performance.js index bec7ac7..eb307bd 100644 --- a/template/js/performance.js +++ b/template/js/performance.js @@ -285,12 +285,13 @@ $("#benchmark").click(function() { } } // Fetch and unzip needed miners one by one - async.eachSeries(promises, function(miner) { + async.eachSeries(promises, function(miner, callback) { fetchAndUnzip(miner, function(validate) { DLComplete(validate, miner, function() { log.info(`Done with miner ${miner.folder+miner.name}`) - }); - }); + callback(null); + }) + }) }, function() { benchmark(); }); @@ -315,10 +316,10 @@ function fetchAndUnzip(miner, callback) { var zip = new AdmZip(path+zipfile); try { zip.extractAllTo(path, true); - log.info(`${miner.folder+miner.name} unzipped.`) } catch(e) { log.error(`Error when unzipping: ${e}`) } + log.info(`${miner.folder+miner.name} unzipped.`) callback(validate); } // .7z @@ -350,15 +351,13 @@ function DLComplete(i, miner, callback) { bar.currentValue += i; bar.animate(bar.currentValue) callback(); - }) - .catch(err => { - log.error(`Error when moving files: ${err}`) - }) + }); + } else { + // Nothing to move + bar.currentValue += i; + bar.animate(bar.currentValue); + callback(); } - // Nothing to move - bar.currentValue += i; - bar.animate(bar.currentValue); - callback(); } // Benchmark setup happens here...