bitcoind: fix clearInterval issue with Node.js 0.12
This commit is contained in:
parent
40e7b24ea9
commit
c3dab07b30
@ -470,12 +470,15 @@ Bitcoin.prototype._checkSyncedAndSubscribeZmqEvents = function(node) {
|
|||||||
}
|
}
|
||||||
if (!synced) {
|
if (!synced) {
|
||||||
interval = setInterval(function() {
|
interval = setInterval(function() {
|
||||||
|
if (self.node.stopping) {
|
||||||
|
return clearInterval(interval);
|
||||||
|
}
|
||||||
checkAndSubscribe(function(err) {
|
checkAndSubscribe(function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, node._tipUpdateInterval || Bitcoin.DEFAULT_TIP_UPDATE_INTERVAL).unref();
|
}, node._tipUpdateInterval || Bitcoin.DEFAULT_TIP_UPDATE_INTERVAL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -720,7 +720,7 @@ describe('Bitcoin Service', function() {
|
|||||||
bitcoind._updateTip.callCount.should.equal(10);
|
bitcoind._updateTip.callCount.should.equal(10);
|
||||||
bitcoind._subscribeZmqEvents.callCount.should.equal(1);
|
bitcoind._subscribeZmqEvents.callCount.should.equal(1);
|
||||||
done();
|
done();
|
||||||
}, 20);
|
}, 40);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user