Skip to content

Commit

Permalink
fix: set agentkeepalive freeSocketTimeout back to 15 seconds (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
nlf committed Feb 15, 2022
1 parent e5b389b commit 3371abf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/agent.js
Expand Up @@ -76,10 +76,12 @@ function getAgent (uri, opts) {
localAddress: opts.localAddress,
rejectUnauthorized: opts.rejectUnauthorized,
timeout: agentTimeout,
freeSocketTimeout: 15000,
}) : new HttpAgent({
maxSockets: agentMaxSockets,
localAddress: opts.localAddress,
timeout: agentTimeout,
freeSocketTimeout: 15000,
})
AGENT_CACHE.set(key, agent)
return agent
Expand Down
5 changes: 5 additions & 0 deletions test/agent.js
Expand Up @@ -52,6 +52,7 @@ t.test('all expected options passed down to HttpAgent', async t => {
maxSockets: 5,
localAddress: 'localAddress',
timeout: 6,
freeSocketTimeout: 15000,
}, 'only expected options passed to HttpAgent')
})

Expand All @@ -61,6 +62,7 @@ t.test('timeout 0 keeps timeout 0', async t => {
maxSockets: 5,
localAddress: 'localAddress',
timeout: 0,
freeSocketTimeout: 15000,
}, 'only expected options passed to HttpAgent')
})

Expand All @@ -70,6 +72,7 @@ t.test('no max sockets gets 15 max sockets', async t => {
maxSockets: 15,
localAddress: 'localAddress',
timeout: 6,
freeSocketTimeout: 15000,
}, 'only expected options passed to HttpAgent')
})

Expand All @@ -79,6 +82,7 @@ t.test('no timeout gets timeout 0', async t => {
maxSockets: 5,
localAddress: 'localAddress',
timeout: 0,
freeSocketTimeout: 15000,
}, 'only expected options passed to HttpAgent')
})

Expand All @@ -92,6 +96,7 @@ t.test('all expected options passed down to HttpsAgent', async t => {
localAddress: 'localAddress',
rejectUnauthorized: 'strictSSL',
timeout: 6,
freeSocketTimeout: 15000,
}, 'only expected options passed to HttpsAgent')
})

Expand Down

0 comments on commit 3371abf

Please sign in to comment.