librelist archives

« back to archive

way to restart jobs when expecting failure

way to restart jobs when expecting failure

From:
Josh Sharpe
Date:
2011-09-12 @ 03:10
There's this 3rd party that I use that is somewhat (a lot) unreliable.  The
most optimal solution I can think of would be to retry this job X times at
interval Y until it succeeds, else, if it fails for the Yth time, then do
something else.

I suppose I could program this directly into the worker.. track how many
times this one has run, rescue the exception and act accordingly.  That
said, is there a better way to handle this that resque already supports?

Thanks!

Re: [resque] way to restart jobs when expecting failure

From:
Josh Nesbitt
Date:
2011-09-12 @ 07:59
You're probably looking for resque-retry, which provides support for 
retrying failed jobs (as well as various strategies to attempt to retry 
jobs, such as exponential backoff).

https://github.com/lantins/resque-retry

On 12 Sep 2011, at 04:10, Josh Sharpe wrote:

There's this 3rd party that I use that is somewhat (a lot) unreliable.  
The most optimal solution I can think of would be to retry this job X 
times at interval Y until it succeeds, else, if it fails for the Yth time,
then do something else.

I suppose I could program this directly into the worker.. track how many 
times this one has run, rescue the exception and act accordingly.  That 
said, is there a better way to handle this that resque already supports?

Thanks!