diff --git a/src/constants.js b/src/constants.js index a66926b1..9cfcb776 100644 --- a/src/constants.js +++ b/src/constants.js @@ -6,7 +6,7 @@ module.exports = { DIAL_TIMEOUT: 30e3, // How long in ms a dial attempt is allowed to take MAX_COLD_CALLS: 50, // How many dials w/o protocols that can be queued MAX_PARALLEL_DIALS: 100, // Maximum allowed concurrent dials - PER_PEER_LIMIT: 4, // Allowed parallel dials per DialRequest + MAX_PER_PEER_DIALS: 4, // Allowed parallel dials per DialRequest QUARTER_HOUR: 15 * 60e3, PRIORITY_HIGH: 10, PRIORITY_LOW: 20 diff --git a/src/dialer/dial-request.js b/src/dialer/dial-request.js index e45282bd..76c24433 100644 --- a/src/dialer/dial-request.js +++ b/src/dialer/dial-request.js @@ -49,7 +49,7 @@ class DialRequest { // For every token, run a multiaddr dial // If there are tokens left, release them // If there are multiaddrs left, wait for tokens to finish - const th = new TokenHolder(tokens, this.dialer.releaseToken) + const th = new TokenHolder(tokens, t => this.dialer.releaseToken(t)) // Create the dial functions const dials = this.addrs.map(addr => { @@ -76,7 +76,7 @@ class DialRequest { * @param {Multiaddr} addr * @param {object} options * @param {AbortSignal} options.signal An AbortController signal - * @param {number} options.timeout The max dial time for each request + * @param {number} options.timeout The max dial time for each request in ms * @returns {{abort: function(), promise: Promise}} An AbortableDial */ _abortableDial (addr, options) {