Browse Source

exponential backoff

activeAddress
Matias Alejo Garcia 10 years ago
parent
commit
895c52bada
  1. 2
      lib/server.js

2
lib/server.js

@ -761,7 +761,7 @@ WalletService.prototype._canCreateTx = function(copayerId, cb) {
var lastTxTs = txs[0].createdOn; var lastTxTs = txs[0].createdOn;
var now = Math.floor(Date.now() / 1000); var now = Math.floor(Date.now() / 1000);
var timeSinceLastRejection = now - lastTxTs; var timeSinceLastRejection = now - lastTxTs;
var backoffTime = WalletService.backoffTime * lastRejections.length; var backoffTime = Math.pow(WalletService.backoffTime,lastRejections.length);
if (timeSinceLastRejection <= backoffTime) if (timeSinceLastRejection <= backoffTime)
log.debug('Not allowing to create TX: timeSinceLastRejection/backoffTime', timeSinceLastRejection, backoffTime); log.debug('Not allowing to create TX: timeSinceLastRejection/backoffTime', timeSinceLastRejection, backoffTime);

Loading…
Cancel
Save