Force timeout net/http

Hi List,

I’m using net/http module to connect to a list of hosts.
How can I force to connect to next host of the list after a timeout?

http.open_timeout = timeout
http.read_timeout = timeout

This doesn’t works! :frowning:

Thank you list,
Al

Alfonso C. wrote:

Hi List,

I’m using net/http module to connect to a list of hosts.
How can I force to connect to next host of the list after a timeout?

http.open_timeout = timeout
http.read_timeout = timeout

This doesn’t works! :frowning:

Thank you list,
Al

If the problem is that it stalls in DNS resolution then
require ‘resolv-replace’ might help.
Surrounding your call with
require ‘timeout’
begin
Timeout::timeout(seconds_to_timeout) { call here } # might work.
rescue Timeout::Error
end
-R