Ruby: difference between read_timeout and open_timeout

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

Relationship Fak

+3
source share
1 answer

open_timeout is the amount of time you are ready to wait for the โ€œconnection to openโ€. In the context of TCP, the amount of time that you waited for the handshake to complete before you discard the attempt and throw a timeout error.

read_timeout , as you might have guessed, is the time when you are ready to wait for some data from the connected side. An example can make this clear:

In SOAP over HTTP through a TCP context (simplified):

  • You are trying to establish a TCP connection to the server. If establishing a connection takes longer than open_timeout, you remove the connection attempt and increase / increase the time / signal / timeout.

  • If the connection is successful, you send an HTTP request. (This may also fail and may have a timeout)

  • Then you wait for a response from the server. If the response takes longer than read_timeout, you throw away the connection and raise / signal / return error.

+7
source

Source: https://habr.com/ru/post/1347107/


All Articles