Merge pull request #268 from maraoz/bug/fix-status-page
Fix status page: percentage bar shows 100% on complete
This commit is contained in:
commit
4e87efd0e5
@ -90,6 +90,7 @@ function spec() {
|
|||||||
|
|
||||||
|
|
||||||
HistoricSync.prototype.info = function() {
|
HistoricSync.prototype.info = function() {
|
||||||
|
this.updatePercentage();
|
||||||
return {
|
return {
|
||||||
status: this.status,
|
status: this.status,
|
||||||
blockChainHeight: this.blockChainHeight,
|
blockChainHeight: this.blockChainHeight,
|
||||||
@ -103,6 +104,12 @@ function spec() {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
HistoricSync.prototype.updatePercentage = function() {
|
||||||
|
var r = (this.syncedBlocks + this.skippedBlocks) / this.blockChainHeight;
|
||||||
|
this.syncPercentage = parseFloat(100 * r).toFixed(3);
|
||||||
|
if (this.syncPercentage > 100) this.syncPercentage = 100;
|
||||||
|
};
|
||||||
|
|
||||||
HistoricSync.prototype.showProgress = function() {
|
HistoricSync.prototype.showProgress = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
@ -112,9 +119,6 @@ function spec() {
|
|||||||
p('ERROR: ' + self.error);
|
p('ERROR: ' + self.error);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
self.syncPercentage = parseFloat(100 * (self.syncedBlocks + self.skippedBlocks) / self.blockChainHeight).toFixed(3);
|
|
||||||
if (self.syncPercentage > 100) self.syncPercentage = 100;
|
|
||||||
|
|
||||||
p(util.format('status: [%d%%] skipped: %d ', self.syncPercentage, self.skippedBlocks));
|
p(util.format('status: [%d%%] skipped: %d ', self.syncPercentage, self.skippedBlocks));
|
||||||
}
|
}
|
||||||
if (self.opts.shouldBroadcastSync) {
|
if (self.opts.shouldBroadcastSync) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user