schmittjoh / JMSJobQueueBundle

Run and Schedule Symfony Console Commands as Background Jobs
http://jmsyst.com/bundles/JMSJobQueueBundle
335 stars 254 forks source link

Add setRetryAfter() method #92

Closed ghost closed 8 years ago

ghost commented 9 years ago

sexMaxRetries is very useful but when a job fails it retries immediately. This might not always be the desired behavior. Consider this example:

When trying to download a remote file that might not always be available (remote server is having capacity issues), we should retry to download it after 1 hour.

That's where setRetryAfter would be useful. Right now to achieve this you need to call setExecuteAfter

So by using setMaxRetries(3) and setExecuteAfter('+1 hour') we will attempt 3 times to download a file with a 1 hour pause between them.

schmittjoh commented 8 years ago

Closing, as this can be achieved using a custom retry scheduler.