Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

[Proposal] Job-based retry / number of attempts #289

Closed
djtarazona opened this issue Nov 3, 2016 · 4 comments
Closed

[Proposal] Job-based retry / number of attempts #289

djtarazona opened this issue Nov 3, 2016 · 4 comments

Comments

@djtarazona
Copy link

djtarazona commented Nov 3, 2016

Currently you can specify how many times a job should be retried when starting the queue daemon (using the --tries option). I find this to be limiting. I'd like to specify the number of attempts / tries per job — on the job class (protected $tries = 2; on the job class). Some types of jobs I may want to retry if they fail such as those that communicate with an external API. But other may be candidates for not retrying at all.

Even better would be an API that allows you to queue the job for retry from within the job such as using $this->retry() in your job class. For example, if you are communicating with an external API and your API request fails with a 503 HTTP status code, you may want to catch that exception and retry the job. But if the HTTP status code was 404, you may not want to retry at all as a subsequent attempt would likely yield the same 404 error.

Taking this idea further, retrying with a specified delay: $this->retry(10); // retry after 10 seconds

With Laravel 5.3, if I want to have different numbers of retries / attempts, I must set up different queues. I'd rather use separate queues for job priority, not number of retries. With the API example ($this->retry()), this would be even more flexible as you could retry the job based on your own logic.

@tomschlick
Copy link

I deal with a ton of jobs and this + #290 would make life so much easier

@JesseObrien
Copy link

👍

@themsaid
Copy link
Member

themsaid commented Nov 4, 2016

This is implemented now, you may close the issue :)

@xyrintech
Copy link

Is this working in 5.8?
One quick question, is tries and retries a separate thing?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants