Thanks Erik. That's great!!
Didn't work initially. Until I tried it outside of irb. For some
reason Timeout::timeout does not seem to work in irb!! Now it is
gracefully continuing after 5 seconds. Perfect.
http://jerith.livejournal.com/40063.html had something to say
regarding problems with timeout and it mentions irb.
Kim
On Jun 25, 11:53 pm, "Erik Peterson" <
thecompanygarde...@gmail.com>
wrote:
> Kim,
>
> Check out Ruby's built-in timeout functionality. Here's an example with a
> timeout and multiple tries.
>
> retries = 2
>
> timeout(5) do
> res = Net::HTTP.new(url.host, url.port).start do |http|
> http.request(req)
> end
> rescue Timeout::Error
> if retries > 0
> retries -= 1
> retry
> else
> # handle the timeout
> end
> end
>
> On Tue, Jun 24, 2008 at 12:10 AM, kim chirnside <
kimmy.chirns...@gmail.com>