【发布时间】:2014-08-10 22:47:36
【问题描述】:
我有一个非常简单的任务 - 我需要检查 submission 在创建后 2 分钟内是否已分配给开发人员。如果没有,请发送电子邮件通知。
用 Rails4 编写的应用程序。我决定使用delayed_job gem。
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 时它才有效。
有什么想法吗?
谢谢!
【问题讨论】: