2014-06-20 35 views
0

我有一个非常简单的任务 - 我需要检查submission是否在创建后2分钟内分配给开发人员。如果没有,发送一封电子邮件通知它。delayed_job只适用于rake作业:workoff,不适用于RAILS_ENV =生产bin/delayed_job开始

用Rails4编写的应用程序。我决定使用delayed_job宝石。

after_create :unassigned_submission_pending_notification 
def unassigned_submission_pending_notification 
    NotificationMailer.unassigned_submissions_pending(self).deliver if developer_id.nil? 
end 
    handle_asynchronously :unassigned_submission_pending_notification, run_at: Proc.new { 2.minutes.from_now } 

documentation据说运行RAILS_ENV=production bin/delayed_job start,使一个工人做他的工作。但在我的情况下,这个命令什么都不做,只有当我运行rake jobs:workoff它的作品。

任何想法为什么?

谢谢!

回答

3

你可以尝试这样的:

RAILS_ENV=production bundle exec bin/delayed_job start 

或者这样:

rake jobs:work 
+0

不工作为好,很遗憾。试过。仍然只有耙子工作:消除火灾通知发送 –

+0

当你做'耙工作:工作'时是否有任何错误? – BriceB

+0

任何,显然这使它工作:)。那么我是否使用这个命令而不是文档中提到的? –

相关问题