Workaround for keepAlive false
This commit is contained in:
@ -26,10 +26,13 @@ class Connection {
|
|||||||
throw new ConfigurationError(`Invalid protocol: '${this.url.protocol}'`)
|
throw new ConfigurationError(`Invalid protocol: '${this.url.protocol}'`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Probably there is a bug in Node Core
|
||||||
|
// see https://github.com/nodejs/node/issues/26357
|
||||||
|
const keepAliveFalse = opts.agent && opts.agent.keepAlive === false
|
||||||
const agentOptions = Object.assign({}, {
|
const agentOptions = Object.assign({}, {
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
keepAliveMsecs: 1000,
|
keepAliveMsecs: 1000,
|
||||||
maxSockets: 256,
|
maxSockets: keepAliveFalse ? Infinity : 256,
|
||||||
maxFreeSockets: 256
|
maxFreeSockets: 256
|
||||||
}, opts.agent)
|
}, opts.agent)
|
||||||
this._agent = this.url.protocol === 'http:'
|
this._agent = this.url.protocol === 'http:'
|
||||||
|
|||||||
Reference in New Issue
Block a user