【问题标题】:jobs is not firing on heroku using hirefire工作没有使用hirefire在heroku上触发
【发布时间】:2013-02-19 16:53:09
【问题描述】:

我正在使用 gem "delayed_job_active_record" 和 heroku 上的雇佣火来在后台运行作业。我还使用我的 heroku 帐户设置了 heroku 环境变量。我在 gem 文件中的序列如下

   gem 'delayed_job_active_record'
   gem 'daemons'
   gem 'hirefire'

它在开发和生产中也在当地环境中工作。但是工作没有从延迟的工作表中触发 heroku。首先,我尝试在 intilizer 中没有配置文件hirefire.rb,但没有成功。在我添加并将此代码放在下面之后。

           HireFire.configure do |config|

             if Rails.env.production?
              config.max_workers = 5 # default is 1
              config.min_workers = 0 # default is 0
              config.job_worker_ratio = [
               {:jobs => 1, :workers => 1},
               {:jobs => 15, :workers => 2},
               {:jobs => 35, :workers => 3},
               {:jobs => 60, :workers => 4},
               {:jobs => 80, :workers => 5}
              ]
        end
      end

但没有成功。虽然hirefire也正在加载,请参见下面的屏幕截图

【问题讨论】:

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


    【解决方案1】:

    可能不应该在那里检查Rails.env.production?,而是将其放入config/environments/production.rb

    要了解如何在 Heroku 中设置延迟作业活动记录,请阅读:https://devcenter.heroku.com/articles/delayed-job

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-31
      • 2014-06-22
      • 2012-09-30
      • 1970-01-01
      • 2021-12-05
      • 1970-01-01
      • 1970-01-01
      • 2021-03-25
      相关资源
      最近更新 更多