Merge pull request #335 from matiu/bug/add-limit-to-async

add concurrency limit
This commit is contained in:
Matias Alejo Garcia 2014-02-14 21:51:01 -02:00
commit 088d7aa7ff
1 changed files with 4 additions and 4 deletions

View File

@ -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);