broadcast last sync status
This commit is contained in:
parent
9bc952a274
commit
6430f05d30
|
@ -70,7 +70,7 @@ function spec() {
|
||||||
|
|
||||||
HistoricSync.prototype.setError = function(err) {
|
HistoricSync.prototype.setError = function(err) {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.error = err.toString();
|
self.error = err.message?err.message:err.toString();
|
||||||
self.status='error';
|
self.status='error';
|
||||||
self.showProgress();
|
self.showProgress();
|
||||||
return err;
|
return err;
|
||||||
|
@ -384,13 +384,12 @@ function spec() {
|
||||||
|
|
||||||
async.whilst(
|
async.whilst(
|
||||||
function() {
|
function() {
|
||||||
|
self.showProgress();
|
||||||
return self.status === 'syncing';
|
return self.status === 'syncing';
|
||||||
},
|
},
|
||||||
function (w_cb) {
|
function (w_cb) {
|
||||||
self.getFn(function(err,blockInfo) {
|
self.getFn(function(err,blockInfo) {
|
||||||
if (err) return w_cb(self.setError(err));
|
if (err) return w_cb(self.setError(err));
|
||||||
|
|
||||||
self.showProgress();
|
|
||||||
if (blockInfo && blockInfo.hash) {
|
if (blockInfo && blockInfo.hash) {
|
||||||
self.syncedBlocks++;
|
self.syncedBlocks++;
|
||||||
self.sync.storeTipBlock(blockInfo, self.allowReorgs, function(err) {
|
self.sync.storeTipBlock(blockInfo, self.allowReorgs, function(err) {
|
||||||
|
@ -408,6 +407,7 @@ function spec() {
|
||||||
else {
|
else {
|
||||||
self.endTs = Date.now();
|
self.endTs = Date.now();
|
||||||
self.status = 'finished';
|
self.status = 'finished';
|
||||||
|
self.shouldBroadcast
|
||||||
return w_cb(err);
|
return w_cb(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue