Skip to content

Commit

Permalink
Sequential miner DL, should reduce risk of dead end, few other hotfix…
Browse files Browse the repository at this point in the history
…es and better logging
  • Loading branch information
fiorinin committed Jan 4, 2018
1 parent 0ab349b commit af80e44
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
11 changes: 8 additions & 3 deletions template/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
});
Expand All @@ -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
Expand All @@ -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();
}
});
Expand All @@ -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();
}
}
Expand Down
23 changes: 11 additions & 12 deletions template/js/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand All @@ -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
Expand Down Expand Up @@ -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...
Expand Down

0 comments on commit af80e44

Please sign in to comment.