laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 28 forks source link

[Proposal] $job->releaseWithoutAttemptsIncrementing() #2310

Closed hivokas closed 3 years ago

hivokas commented 4 years ago

When I use Redis::funnel()/Redis::throttle and release the job in case the lock could not be obtained, I don't want the number of attempts to be incremented. If that's already possible, please let me know. If no, then what do you think about that?

mitoop commented 4 years ago

Encountered the same problem

zhuzhichao commented 4 years ago

The document said,

When using rate limiting, the number of attempts your job will need to run successfully can be hard to determine. Therefore, it is useful to combine rate limiting with time based attempts. https://laravel.com/docs/7.x/queues#rate-limiting

Howerer I don't think it's a better solution. Amount job will cast lots of time, we are not sure when they will be done.

Suggest:

If Redis::funnel()/Redis::throttle don't increment attempts, we can use the times option effectively.

divdax commented 3 years ago

I ran into that problem too. I vote for requeue() 😄

themsaid commented 3 years ago

Use retryUntil and maxExceptions. Check https://laravel.com/docs/8.x/queues#max-exceptions