-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add agent socket reuse #15
Conversation
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.
Solid start! 👌 The tests stalling without agent: false
smells like a missing unref()
somewhere so that's worth looking into; they should pass just fine even with the global agent.
Maybe it's missing somewhere at |
Looking into the HTTP server implementation in Node.js, it explicitly closes idle connections when closing the server: https://github.com/nodejs/node/blob/362afa52ebe462a39874915e5e70d261db153c58/lib/_http_server.js#L592-L606. The lack of that is most likely what causes the tests to stall. |
ab95cda
to
f8951fd
Compare
I had a hard time making the CI work after the At |
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 tweaked the last bits so this should be ready to land now 👏
Not included on this first draft:
addedagent.reuseSocket
request parameterscheduling
optionWhat is included:
agent.getSocket
and socket 'free' eventExtra thing: because
http.request
by default uses the global agent, which enableskeepAlive
by default, it made some previous tests start to get stuck, the solution was to addagent: false
option.