Reputation: 1932
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.
Upvotes: 5
Views: 1471
Reputation: 1364
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.
Upvotes: 1