Best current rails background task method?

后端 未结 3 458
醉话见心
醉话见心 2021-02-08 01:11

I am trying to find out the best way to run scripts in the background. I have been looking around and found plenty of options, but many/most seem to have become inactive in the

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-08 01:51

    I think you're looking for a background job queuing system.

    For that, you're either looking for resque or delayed_job. Both support scheduling tasks at some point in the future -- delayed_job does this natively, whereas resque has a plugin for it called resque_scheduler.

    You would enqueue jobs in the background with parameters that you specify, and then at the time you selected they'll be executed. You can set jobs to recur indefinitely or a fixed number of times (at least with resque-scheduler, not sure about delayed_job).

    delayed_job is easier to set up since it saves everything in the database. resque is more robust but requires you to have redis in your stack -- but if you do already it's pretty much the ideal solution for your problem.

提交回复
热议问题