问题
I am running delayed job with command RAILS_ENV=production bin/delayed_job start
.
i am storing jobs with below code
Delayed::Job.enqueue QrCodeGenerator.new(client,request,params[:batch_quantity].to_i)
Currently delayed job is running jobs simeltanoulsy. i want know how to run job one after another.
Thanks,
回答1:
If this job is always gonna be the same job but just with different input parameters, you can just run
QUEUE=myqueue rake jobs:work
because that rake process will run one job at a time. You can then run another simultaneous delayed_job rake process to run other queues as a concurrent worker (if you have other jobs that needs to be processed).If the sequential jobs you are talking about however are of different jobs / class, then you can just call the other job once the first job has finished.
来源:https://stackoverflow.com/questions/34739958/delayed-job-how-to-process-job-sequentially-one-after-another