Address Service: Limit the number of simultaneous requests
This commit is contained in:
parent
ca19994326
commit
93e5dbfc34
|
@ -49,6 +49,8 @@ exports.MAX_OUTPUTS_QUERY_LENGTH = 50000;
|
|||
exports.MAX_HISTORY_QUERY_LENGTH = 100;
|
||||
// The maximum number of addresses that can be queried at once
|
||||
exports.MAX_ADDRESSES_QUERY = 10000;
|
||||
// The maximum number of simultaneous requests
|
||||
exports.MAX_ADDRESSES_LIMIT = 50;
|
||||
|
||||
module.exports = exports;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ function AddressHistory(args) {
|
|||
|
||||
this.maxHistoryQueryLength = args.options.maxHistoryQueryLength || constants.MAX_HISTORY_QUERY_LENGTH;
|
||||
this.maxAddressesQuery = args.options.maxAddressesQuery || constants.MAX_ADDRESSES_QUERY;
|
||||
this.maxAddressesLimit = args.options.maxAddressesLimit || constants.MAX_ADDRESSES_LIMIT;
|
||||
|
||||
this.addressStrings = [];
|
||||
for (var i = 0; i < this.addresses.length; i++) {
|
||||
|
@ -89,8 +90,9 @@ AddressHistory.prototype.get = function(callback) {
|
|||
} else {
|
||||
var opts = _.clone(this.options);
|
||||
opts.fullTxList = true;
|
||||
async.map(
|
||||
async.mapLimit(
|
||||
self.addresses,
|
||||
self.maxAddressesLimit,
|
||||
function(address, next) {
|
||||
self.node.services.address.getAddressSummary(address, opts, next);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue