Delayed job: How to process job sequentially (one

2019-06-04 08:18发布

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条回答
我命由我不由天
2楼-- · 2019-06-04 08:51
  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).

  2. 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.

查看更多
登录 后发表回答