diff --git a/lib/TransactionDb.js b/lib/TransactionDb.js index 6c1efcd..5eb7d7c 100644 --- a/lib/TransactionDb.js +++ b/lib/TransactionDb.js @@ -21,7 +21,7 @@ function spec(b) { // TODO: use bitcore networks module var genesisTXID = '4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b'; - var CONCURRENCY = 100; + var CONCURRENCY = 10; var MAX_OPEN_FILES = 500; /** @@ -318,7 +318,7 @@ function spec(b) { if (o.multipleSpendAttempts) { - async.each(o.multipleSpendAttempts, + async.eachLimit(o.multipleSpendAttempts, CONCURRENCY, function(oi, e_c) { self.isConfirmed(oi.spendTxId, function(err, is) { if (err) return; @@ -365,7 +365,7 @@ function spec(b) { }) .on('end', function() { - async.each(ret, function(o, e_c) { + async.eachLimit(ret, CONCURRENCY, function(o, e_c) { var k = SPEND_PREFIX + o.txid + '-' + o.index; db.createReadStream({ start: k, @@ -383,7 +383,7 @@ function spec(b) { }); }, function() { - async.each(ret, function(o, e_c) { + async.eachLimit(ret, CONCURRENCY, function(o, e_c) { self.fillConfirmations(o, e_c); }, function(err) { return cb(err, ret);