Ruby: Difference between read_timeout and open_timeout

前端 未结 1 1441

The title explains itself... what\'s the difference between read_timeout and open_timeout?

相关标签:
1条回答
  • 2021-01-18 09:05

    open_timeout is the amount of time you are willing to wait for 'opening a connection'. In TCP context, the amount of time you wait for the handshake to complete before dropping the attempt and throwing a timeout error.

    read_timeout as you might guess, is the time you are willing to wait for some data to be received from the connected party. An example might make this clear:

    In SOAP over HTTP over TCP context (simplified):

    • You try to establish a TCP connection with the server. If the connection establishment takes longer than open_timeout, you drop the connection attempt and raise/signal/return timeout error.

    • If connection is successful, you send the HTTP request out. (This can fail too, and can have it's own timeout)

    • You then wait for a response from the server. If the response takes longer than read_timeout, you drop the connection and raise/signal/return timeout error.

    0 讨论(0)
提交回复
热议问题