Workaround for keepAlive false
This commit is contained in:
@ -26,10 +26,13 @@ class Connection {
|
||||
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({}, {
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: 1000,
|
||||
maxSockets: 256,
|
||||
maxSockets: keepAliveFalse ? Infinity : 256,
|
||||
maxFreeSockets: 256
|
||||
}, opts.agent)
|
||||
this._agent = this.url.protocol === 'http:'
|
||||
|
||||
Reference in New Issue
Block a user