Skip to content
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

Support reusing the same Socket for multiple requests #594

Open
kettanaito opened this issue Jul 4, 2024 · 0 comments
Open

Support reusing the same Socket for multiple requests #594

kettanaito opened this issue Jul 4, 2024 · 0 comments

Comments

@kettanaito
Copy link
Member

In theory, you can reuse the same Socket instance for multiple HTTP requests. There's a bunch of Socket pools in the Agent and the agent decides which socket to use at which time.

That being said, I don't believe we allow our MockHttpSocket to be used that way. For once, each Socket instance has its own HTTP request/response parser instances, and I'm not sure if reusing sockets implies parallel reusing or sequential. I bet on sequential but who knows.

The tests for this are in works here: #560. I wasn't able to even recreate a raw, unmocked scenario of how you can reuse a socket like that. There's a solid chance I misread the Node.js docs and sockets cannot be used that way. No matter way I do with a keepalive socket/request, it never gets reused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant