Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can a delayed job be made dependent on another job?

With Rails 3.2, is it possible to setup a delayed job so that it has a dependency on another delayed job, such that it will not run until the other job has finished (either successfully or not)? I have a class that spins off a large number of delayed jobs that need to be run sequentially to prevent a race condition. For performance reasons it is not possible to wait for each job to complete synchronously, though if it's not possible to put dependencies on jobs I could create a delayed job that runs each job in turn and waits for it to complete.

like image 531
Mike Avatar asked Nov 09 '22 23:11

Mike


1 Answers

I agree with the author of this thread:

I would create a model to keep track of which steps are finished and not enqueue the next step until the previous ones are finished.

like image 103
Axel Tetzlaff Avatar answered Nov 15 '22 04:11

Axel Tetzlaff