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

Difference between timeout and open_timeout #1469

Closed
Yu-Chieh-Henry-Yang opened this issue Dec 14, 2022 · 4 comments
Closed

Difference between timeout and open_timeout #1469

Yu-Chieh-Henry-Yang opened this issue Dec 14, 2022 · 4 comments

Comments

@Yu-Chieh-Henry-Yang
Copy link
Contributor

Yu-Chieh-Henry-Yang commented Dec 14, 2022

We have these comment in the codebase:

# - `:timeout` open/read timeout Integer in seconds
# - `:open_timeout` - read timeout Integer in seconds

:timeout says open/read timeout Integer in seconds
:open_timeout says read timeout Integer in seconds

Question 1: Does this mean timeout includes open_timeout? For example, if everything times out at the limit and we configured to have 4 seconds open_timeout and 6 seconds timeout, do we actually wait only 6 seconds (which includes the 4 seconds) or do we actually wait 4+6 = 10 seconds?

Question 2: :open_timeout is called "open" timeout, why does it says read timeout Integer in seconds instead of something like timeout Integer in seconds for opening connection?

Thank you very much.

@iMacTia
Copy link
Member

iMacTia commented Dec 20, 2022

Hi @Yu-Chieh-Henry-Yang, apologies if this is confusing.

timeout is a setting for the whole request and thus is calculated for both opening the connection and reading the response (open/read). If the request hasn't finished after this threshold (even if some data have been received in the meantime), then it will timeout.

OTOH open_timeout is only used to time the opening of the connection (i.e. time to first byte received). If the server replies with some data before this threshold, then no timeout will be raised (unless obviously the requests goes over the timeout threshold.

@iMacTia
Copy link
Member

iMacTia commented Dec 20, 2022

You're right though the description for open_timeout seems incorrect!
It should be :open_timeout - open timeout Integer in seconds

@iMacTia
Copy link
Member

iMacTia commented Dec 20, 2022

There are 2 more types of timeout, I've added a comment to explain them all to your PR 👍
Thank you for addressing this 🙏 !

@Yu-Chieh-Henry-Yang
Copy link
Contributor Author

Thanks for the explanation @iMacTia , I will continue the conversation in my PR. 🙏

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

2 participants