force timeout net/http

A

Alfonso Caponi

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! :(

Thank you list,
Al
 
R

Roger Pack

Alfonso said:
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! :(

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top