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() {
|
||||
this.updatePercentage();
|
||||
return {
|
||||
status: this.status,
|
||||
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() {
|
||||
var self = this;
|
||||
|
||||
|
@ -112,9 +119,6 @@ function spec() {
|
|||
p('ERROR: ' + self.error);
|
||||
}
|
||||
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));
|
||||
}
|
||||
if (self.opts.shouldBroadcastSync) {
|
||||
|
|
Loading…
Reference in New Issue