Displaying 1 result from an estimated 1 matches for "with_retries".
2006 Dec 31
0
Retrying requests
I use this method to retry my requests if there are retrieval problems.
def with_retries(num_retries = 4)
begin
yield
rescue Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EHOSTUNREACH,
Errno::ECONNREFUSED, Errno::ETIMEDOUT, Timeout::Error,
WWW::Mechanize::ResponseCodeError
num_retries -= 1
retry unless num_retries < 0
raise
end
end
So I can try three t...