chore: apply suggestions from code review

Co-Authored-By: Vasco Santos <vasco.santos@moxy.studio>
Co-Authored-By: Alan Shaw <alan.shaw@protocol.ai>
This commit is contained in:
Jacob Heun 2019-12-04 13:53:32 +01:00
parent cba2c6d8b2
commit 571fd3b7d1
No known key found for this signature in database
GPG Key ID: CA5A94C15809879F
2 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@ module.exports = {
DIAL_TIMEOUT: 30e3, // How long in ms a dial attempt is allowed to take 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_COLD_CALLS: 50, // How many dials w/o protocols that can be queued
MAX_PARALLEL_DIALS: 100, // Maximum allowed concurrent dials 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, QUARTER_HOUR: 15 * 60e3,
PRIORITY_HIGH: 10, PRIORITY_HIGH: 10,
PRIORITY_LOW: 20 PRIORITY_LOW: 20

View File

@ -49,7 +49,7 @@ class DialRequest {
// For every token, run a multiaddr dial // For every token, run a multiaddr dial
// If there are tokens left, release them // If there are tokens left, release them
// If there are multiaddrs left, wait for tokens to finish // 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 // Create the dial functions
const dials = this.addrs.map(addr => { const dials = this.addrs.map(addr => {
@ -76,7 +76,7 @@ class DialRequest {
* @param {Multiaddr} addr * @param {Multiaddr} addr
* @param {object} options * @param {object} options
* @param {AbortSignal} options.signal An AbortController signal * @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<Connection>}} An AbortableDial * @returns {{abort: function(), promise: Promise<Connection>}} An AbortableDial
*/ */
_abortableDial (addr, options) { _abortableDial (addr, options) {