-
Notifications
You must be signed in to change notification settings - Fork 13
Pass keepAlive from custom agent #68
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
base: main
Are you sure you want to change the base?
Conversation
If client uses a custom http or https agent, then pass its keepAlive flag in creation of PacProxyAgent.
@microsoft-github-policy-service agree company="Sourcegraph" |
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.
Thanks for the PR, left two comments.
@@ -0,0 +1,200 @@ | |||
lockfileVersion: '9.0' |
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.
This file slipped in. Please remove it from the PR.
@@ -158,8 +158,7 @@ describe('Direct client', function () { | |||
}); | |||
assert.ok(seen, 'Original agent not called!'); | |||
}); | |||
it.skip('should reuse socket with agent', async function () { | |||
// Skipping due to https://github.com/microsoft/vscode/issues/228872. | |||
it('should reuse socket with agent', async function () { | |||
// https://github.com/microsoft/vscode/issues/173861 | |||
const { resolveProxyWithRequest: resolveProxy } = vpa.createProxyResolver(directProxyAgentParams); | |||
const patchedHttps: typeof https = { |
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.
The two requests below need a custom agent with keepAlive = true for the socket to be reused.
Currently, keepAlive flag is ignored in this issue. This causes to keepAlive to be false at agent level, which prevents connection re-use for all endpoints (see nodejs Agent). While some servers may not support keep-alive well, globally disabling the flag seems too broad of impact. It would be great if clients can decide on whether to use keepAlive (through request's keepAlive) instead.
This PR changes the logic of passing keepAlive flag. If client uses a custom http or https agent, then pass its keepAlive flag in creation of PacProxyAgent.