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

Connection timeout for long running streams #9

Open
vaditya92 opened this issue Sep 13, 2020 · 0 comments
Open

Connection timeout for long running streams #9

vaditya92 opened this issue Sep 13, 2020 · 0 comments

Comments

@vaditya92
Copy link

vaditya92 commented Sep 13, 2020

I am working on something which requires the stream to be used for a longer period more than the default timeout. I have noticed that in Node version prior to v14, even though the request times out with ETIMEDOUT error, the other operations using that stream worked fine. I think in Node v14.0.0 this is not supported. As soon as there is a socket error, all other operations are suspended. I assume this is the PR for that change but I could be wrong.

I compared the timeout scenario used in this library with another http client axios. They remove the timeout reference as soon as a response is obtained from the server. Can we do a similar change here?
Eg:

currentRequest.once('error', handleRequestError)
.once('response', function handleResponse(response) {
// Clear timeout reference
currentRequest.removeAllListeners('timeout');

// Other operations
}

Or if someone can point me in the right direction, I can work on this fix.

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