-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes/3649 use same http agent for requests #3748
Fixes/3649 use same http agent for requests #3748
Conversation
Status
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
lib/http/request.js
Outdated
} | ||
|
||
static getHttpKeepAliveAgent({keepAliveMsecs, maxSockets}) { | ||
if (!__httpKeepAliveAgent__) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was suggesting to refactor this into something like
function getAgent(secure) {
const protocol = secure ? https : http;
return __httpKeepAliveAgent__ = new protocol.Agent({
keepAlive: true,
keepAliveMsecs,
maxSockets
});
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored and removed __httpsKeepAliveAgent__
as we would need only a variable per test session/process (either http
or https
agent). For multiple envs we use worker_threads or child process which won't share instances of global variables.
Changes
Impacts