Reputation: 570
I'm a bit confuse about how to run the job only once, because when I set the parameter "tries" to 1 and the job fails, it execute one more time. If I set the tries parameter to 3, the job runs 4 times. And finally if I set to 0, the jobs run indefinitely. Below my settings in config/horizon.php:
'production' =
'default' => [
'connection' => 'redis',
'queue' => [
'default',
'notifications',
'dom'
],
'balance' => 'auto',
'maxProcesses' => env('MAX_PROCESSES', 45),
'timeout' => 60,
'tries' => 1,
],
],
And below my settings in config/queue.php
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'retry_after' => 90,
],
And other question, what setting dispatch the "has been attempted to many times or run too along"?
Upvotes: 2
Views: 798
Reputation: 570
Just set an attribute $tries = 1
to the Job, and on the catch of possible errors, call $this->fail()
;
Upvotes: 2