Merge pull request #21 from chjj/fix-percent

chain: fix fill percent.
This commit is contained in:
Fedor Indutny 2014-05-27 10:08:51 +04:00
commit 2e0660f449

View File

@ -342,7 +342,7 @@ Chain.prototype.isFull = function isFull() {
Chain.prototype.fillPercent = function fillPercent() {
var total = (+new Date() / 1000 - 40 * 60) - this.index.lastTs;
var current = this.index.ts[this.index.ts.length - 1] - this.index.lastTs;
return Math.min(0, Math.max(current / total, 1));
return Math.max(0, Math.min(current / total, 1));
};
Chain.prototype.hashesInRange = function hashesInRange(start, end, cb) {