Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between timeout and open timeout?

In the Ruby RestClient gem, what's the difference between the timeout and open-timeout functionality?

http://www.ruby-doc.org/gems/docs/w/wgibbs-rest-client-1.0.5/RestClient/Resource.html#method-i-open_timeout

I didn't get anything from the doc file of the gem either.

like image 817
Pratik Bothra Avatar asked Apr 17 '13 12:04

Pratik Bothra


1 Answers

You're reading the wrong documentation (yours is for wgibbs-rest-client which has not been updated since 2009): here's the right one. But that one does not say anything about the difference either, although it is simple:

:open_timeout is the timeout for opening the connection. This is useful if you are calling servers with slow or shaky response times.

:timeout is the timeout for reading the answer. This is useful to make sure you will not get stuck half way in the reading process, or get stuck reading a 5 MB file when you're expecting 5 KB of JSON.

like image 192
Beat Richartz Avatar answered Oct 13 '22 15:10

Beat Richartz