2

I have three jobs in my queue;

  • A
  • B
  • C

Retry count for one of them is set to 100.

When all my jobs are failing, Laravel runs the jobs as following scheme;

  • A 1
  • B 1
  • C 1

and then;

  • A 2
  • B 2
  • C 2

I want to change this behavior as the following scheme;

  • A 100 (to failed table)
  • B 1
  • C 0

So I want the previous jobs to be blocking tikk they reach their retry counts and then continue to the next job.

How can I achieve this with Laravel’s Job system?

( I can’t chain the jobs on my software layer with chain method. I would like to achieve this by configuration )

Süha Boncukçu
  • 913
  • 1
  • 10
  • 29

2 Answers2

1

You could use Job Events to control the sequence in which they are pushed on to a queue. Once job A successfully finishes, Job B starts via an event listener, same for Job C. Job A can retry 100 times with no way of triggering Job B.

0

If this is a job you cannot control another job from that one... Jobs are working asynchronously. You need to get things done synchronously :)

So or you move everything into one job, or you cannot do it in another way :)

Of course, you can name your queues, and run with prioritizing them and setup only 1 worker... But this isn't a good option and you cannot be good with that :)


Also, you can fire job after one job is done. Just move creating a job from your controller(?) into the job after the finish. I have that solution implemented in my own system. Only if one job is done, then next is firing

  • I guess there isn't any way to run the jobs sequentially as you pointed out. I will use your answer and implement my own architecture. Every job will get the next job from a `passive jobs table` and add it to the job queue. – Süha Boncukçu Feb 13 '18 at 08:53