D
Daniel Berger
Hi all,
What would folks think of allowing retry to take two arguments - a
num_retries and delay argument. Then you could do something like this:
begin
connect_to_something
rescue Exception
# Retry up to 3 times, sleeping 30 seconds between attempts
retry(3, 30)
raise
end
This would mostly be a convenience for db/network code, though I'm not
sure what other clever uses one might come up for it.
Good idea? Fraught with danger? Too difficult to implement? Too
specialized?
Inspired by Mark Fowler's Attempt module -
http://search.cpan.org/dist/Attempt/lib/Attempt.pm
Regards,
Dan
What would folks think of allowing retry to take two arguments - a
num_retries and delay argument. Then you could do something like this:
begin
connect_to_something
rescue Exception
# Retry up to 3 times, sleeping 30 seconds between attempts
retry(3, 30)
raise
end
This would mostly be a convenience for db/network code, though I'm not
sure what other clever uses one might come up for it.
Good idea? Fraught with danger? Too difficult to implement? Too
specialized?
Inspired by Mark Fowler's Attempt module -
http://search.cpan.org/dist/Attempt/lib/Attempt.pm
Regards,
Dan