Merge pull request #335 from matiu/bug/add-limit-to-async
add concurrency limit
This commit is contained in:
commit
088d7aa7ff
|
@ -21,7 +21,7 @@ function spec(b) {
|
||||||
|
|
||||||
// TODO: use bitcore networks module
|
// TODO: use bitcore networks module
|
||||||
var genesisTXID = '4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b';
|
var genesisTXID = '4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b';
|
||||||
var CONCURRENCY = 100;
|
var CONCURRENCY = 10;
|
||||||
|
|
||||||
var MAX_OPEN_FILES = 500;
|
var MAX_OPEN_FILES = 500;
|
||||||
/**
|
/**
|
||||||
|
@ -318,7 +318,7 @@ function spec(b) {
|
||||||
|
|
||||||
if (o.multipleSpendAttempts) {
|
if (o.multipleSpendAttempts) {
|
||||||
|
|
||||||
async.each(o.multipleSpendAttempts,
|
async.eachLimit(o.multipleSpendAttempts, CONCURRENCY,
|
||||||
function(oi, e_c) {
|
function(oi, e_c) {
|
||||||
self.isConfirmed(oi.spendTxId, function(err, is) {
|
self.isConfirmed(oi.spendTxId, function(err, is) {
|
||||||
if (err) return;
|
if (err) return;
|
||||||
|
@ -365,7 +365,7 @@ function spec(b) {
|
||||||
})
|
})
|
||||||
.on('end', function() {
|
.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;
|
var k = SPEND_PREFIX + o.txid + '-' + o.index;
|
||||||
db.createReadStream({
|
db.createReadStream({
|
||||||
start: k,
|
start: k,
|
||||||
|
@ -383,7 +383,7 @@ function spec(b) {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
async.each(ret, function(o, e_c) {
|
async.eachLimit(ret, CONCURRENCY, function(o, e_c) {
|
||||||
self.fillConfirmations(o, e_c);
|
self.fillConfirmations(o, e_c);
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
return cb(err, ret);
|
return cb(err, ret);
|
||||||
|
|
Loading…
Reference in New Issue