Lower and include new concurrency limits
This commit is contained in:
parent
6a899e4b9c
commit
f473ddeddd
@ -50,7 +50,7 @@ exports.MAX_HISTORY_QUERY_LENGTH = 100;
|
|||||||
// The maximum number of addresses that can be queried at once
|
// The maximum number of addresses that can be queried at once
|
||||||
exports.MAX_ADDRESSES_QUERY = 10000;
|
exports.MAX_ADDRESSES_QUERY = 10000;
|
||||||
// The maximum number of simultaneous requests
|
// The maximum number of simultaneous requests
|
||||||
exports.MAX_ADDRESSES_LIMIT = 50;
|
exports.MAX_ADDRESSES_LIMIT = 5;
|
||||||
|
|
||||||
module.exports = exports;
|
module.exports = exports;
|
||||||
|
|
||||||
|
|||||||
@ -51,6 +51,7 @@ function DB(options) {
|
|||||||
this._setDataPath();
|
this._setDataPath();
|
||||||
|
|
||||||
this.maxOpenFiles = options.maxOpenFiles || DB.DEFAULT_MAX_OPEN_FILES;
|
this.maxOpenFiles = options.maxOpenFiles || DB.DEFAULT_MAX_OPEN_FILES;
|
||||||
|
this.maxTransactionLimit = options.maxTransactionLimit || DB.MAX_TRANSACTION_LIMIT;
|
||||||
|
|
||||||
this.levelupStore = leveldown;
|
this.levelupStore = leveldown;
|
||||||
if (options.store) {
|
if (options.store) {
|
||||||
@ -75,6 +76,11 @@ DB.PREFIXES = {
|
|||||||
TIP: new Buffer('04', 'hex')
|
TIP: new Buffer('04', 'hex')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// The maximum number of transactions to query at once
|
||||||
|
// Used for populating previous inputs
|
||||||
|
DB.MAX_TRANSACTION_LIMIT = 5;
|
||||||
|
|
||||||
|
// The default maxiumum number of files open for leveldb
|
||||||
DB.DEFAULT_MAX_OPEN_FILES = 200;
|
DB.DEFAULT_MAX_OPEN_FILES = 200;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -5,6 +5,8 @@ var levelup = require('levelup');
|
|||||||
var bitcore = require('bitcore-lib');
|
var bitcore = require('bitcore-lib');
|
||||||
var Transaction = bitcore.Transaction;
|
var Transaction = bitcore.Transaction;
|
||||||
|
|
||||||
|
var MAX_TRANSACTION_LIMIT = 5;
|
||||||
|
|
||||||
Transaction.prototype.populateInputs = function(db, poolTransactions, callback) {
|
Transaction.prototype.populateInputs = function(db, poolTransactions, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
@ -12,8 +14,9 @@ Transaction.prototype.populateInputs = function(db, poolTransactions, callback)
|
|||||||
return setImmediate(callback);
|
return setImmediate(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
async.each(
|
async.eachLimit(
|
||||||
this.inputs,
|
this.inputs,
|
||||||
|
db.maxTransactionLimit || MAX_TRANSACTION_LIMIT,
|
||||||
function(input, next) {
|
function(input, next) {
|
||||||
self._populateInput(db, input, poolTransactions, next);
|
self._populateInput(db, input, poolTransactions, next);
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user