ara.t.howard / noaa.gov wrote:
> On Thu, 17 Aug 2006, Jeffrey wrote:
>
> > I love open-uri, but does anyone know how to configure the time-out
> > before open() will throw a Timeout::Error?  I'd like to make it
> > shorter.

> the simple way is
>
>    require 'timeout'
>
>    retries = 42
>
>    begin
>      Timeout::timeout(s){
>        open('http://a.url.com') do |f|
>          # ... stuff with f
>        end
>      }
>    rescue Timeout::Error
>      retries -= 1
>      if retry > 0
>        sleep 0.42 and retry
>      else
>        raise
>      end
>    end

Thanks, that's great.  It seems to be working.