-
-
Notifications
You must be signed in to change notification settings - Fork 959
Response read timeout #1512
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
Comments
This is actually not a bug. In the second example Got has actually successfully received the entire response body, but you haven't read it from the stream (missing The last example actually times out, because Got doesn't read from the socket as it waits for your acknowledgement. |
The proper solution is to attach a timeout to the stream of |
If you consider this a feature request (do let me know) then I'll reopen and wait for @sindresorhus' opinion on this :) |
Sure, I'm happy to consider it a feature request instead. :] Our team internally has been debating whether we consider it a bug since it has to do with the consumption of the stream. Ultimately it just felt strange because of the inconsistency. Without having this handled by got's timeout, since we have multiple places we make streaming requests we'll probably end up wrapping those calls to add our own timeout logic. One possibility that was on my mind was adding an additional timeout type. Since |
@sindresorhus What about a new timeout option: |
/cc @Giotino What do you think? ^^^^ |
@szmarczak Sounds good to me. |
Describe the bug
We've noticed that the timeout isn't applied very consistently when using streams and piping the stream to something slow. It's not particularly obvious if the timeout is meant to account for this.
Actual behavior
Depending on the backpressure of the stream being piped to, the stream returned by
got.stream()
may end, error, or hang.Expected behavior
I expected the timeout to trigger consistently rather than depending on the backpressure.
Code to reproduce
Output:
Checklist
I'm willing to try to open a PR to address this, but I want to be sure that this isn't considered expected behavior since it has as much to do with the stream being piped to as it does got itself. While that's true, I think the expectation when passing
timeout
is that the request can't hang indefinitely.The text was updated successfully, but these errors were encountered: