Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby: Net::HTTP idle timeout?

I am using the Ruby standard library to create persistent connect:

Net::HTTP.new(host, port)

Does ruby close the connection itself after idle for some times?

like image 979
user926958 Avatar asked Oct 25 '12 18:10

user926958


1 Answers

Yes. The default for MRI Ruby is 60 seconds.

http = Net::HTTP.new(host, port)
http.read_timeout # -> 60

If you want a connection does not timeout you can set read_timeout to nil

http.read_timeout = nil
like image 186
lastcanal Avatar answered Oct 21 '22 17:10

lastcanal