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

don't set connect timeout for keepalive #86

Merged
merged 1 commit into from
Jun 7, 2018

Conversation

dbushong
Copy link
Member

@dbushong dbushong commented Jun 7, 2018

If you have an existing socket from a KeepAlive connection, the
connect event will never be fired, which causes the timeout to fire,
which was closing the KeepAlive'd connection

See: https://github.com/request/request/blob/a6741d415aba31cd01e9c4544c96f84ea6ed11e3/request.js#L778-L779

Copy link
Collaborator

@jkrems jkrems left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor nit, otherwise LGTM

lib/request.js Outdated
connectTimer = setIOTimeout(onConnectTimedOut, options.connectTimeout);
socket.once('connect', onConnect);
if (socket._connecting || socket.connecting) {
timing.socket = Date.now() - startTime;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd still want to record the time it took to get a socket, e.g. in the case of queueing requests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right

If you have an existing socket from a KeepAlive connection, the
`connect` event will never be fired, which causes the timeout to fire,
which was closing the KeepAlive'd connection
@dbushong dbushong force-pushed the dbushong/feature/master/fix-connect-timeout branch from 4b54555 to cd57ced Compare June 7, 2018 20:27
@dbushong
Copy link
Member Author

dbushong commented Jun 7, 2018

fixed

@dbushong dbushong merged commit a1f1af0 into master Jun 7, 2018
@dbushong dbushong deleted the dbushong/feature/master/fix-connect-timeout branch June 7, 2018 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants