如何在开发中的rails 3中使用hirefire for delayed_job?

时间:2011-10-09 00:41:02

标签: ruby-on-rails-3 delayed-job hirefire

我正在使用delayed_jobs开发一个带有rails 3的应用程序。我正在使用Hirefire在需要时扩展和缩小工作人员。如何在我的开发环境中使用hirefire,以测试它是否按预期工作。

然后我应该如何配置它以便它也可以在Heroku Cedar堆栈的生产环境中工作。

1 个答案:

答案 0 :(得分:5)

您需要做的是将environment设置为:local。默认情况下,它设置为:noop,它不执行任何操作。为此,请在Rails.root/config/initializers/hirefire.rb创建一个用于雇佣的初始化程序。在初始化程序中,添加以下

HireFire.configure do |config|
  if Rails.env.production?
    config.environment = :heroku
   else
    config.environment = :local
  end
  # add any other configuration you want here
end