Hi: What about http://search.cpan.org/~dlo/Proc-BackOff-0.02/lib/Proc/BackOff.pm
Proc::BackOff. It seems to implement a function similar to TCP packet retry backoff... The idea is that for every failure you wait X time before the next request; the next time, you wait 2X. etc. But there is also an exponential backoff one. Hope this helps. I haven't read the module description thoroughly but it deals with doing retries in a way that doesn't totally hammer a system and bring it to its knees. Cheers, Jonathan On Tue, Apr 21, 2009 at 4:11 PM, Bill Ward <b...@wards.net> wrote: > I am planning to write a new module that would manage retries. Let's say > you want to talk to some network service that might have errors or be > offline, and if you get certain kinds of errors (e.g. the host is being > rebooted, so it's not responding, but will shortly) you want to try again > after some set interval. But you don't want to retry forever - eventually > it should be a hard error. > > We already have this kind of logic embedded in one place but I want to write > a generic object that would basically hold the retry parameters > (RETRY_COUNT, RETRY_DIE, RETRY_SLEEP, RETRY_SLEEP_MULTIPLIER, > RETRY_SLEEP_LIMIT) and respond to queries like: > > - Something failed - should I retry or die? (if number of retries so far is > less than RETRY_COUNT) > - How long should I sleep for / wake me up when the sleep time has passed > - etc. > > I haven't seen anything on CPAN that does this - a quick search for "retry" > on CPAN yields tons of results but they all appear to be very > domain-specific or just a mention in the documentation of some particular > module. > > Something like Object::Retry maybe? Then things can inherit from it? >