Ruby 延迟的\u作业,从延迟的方法中发送邮件
我有一个延迟方法async\u checkout\u assist,它按预期运行,添加到表中并执行,没有任何问题,执行后从表中删除,但在该延迟方法中,如果条件为真,我希望发送邮件,但当我添加邮件程序行时,它不会发送邮件:\ 现在这两种方法都适用Ruby 延迟的\u作业,从延迟的方法中发送邮件,ruby,ruby-on-rails-3,delayed-job,Ruby,Ruby On Rails 3,Delayed Job,我有一个延迟方法async\u checkout\u assist,它按预期运行,添加到表中并执行,没有任何问题,执行后从表中删除,但在该延迟方法中,如果条件为真,我希望发送邮件,但当我添加邮件程序行时,它不会发送邮件:\ 现在这两种方法都适用 1.是否在延迟作业表中创建任务?2.您确定已启动延迟作业辅助进程来处理作业吗?是的,我已重新启动该辅助进程,然后该辅助进程将async_checkout_assist方法添加到表中并成功运行,但当该方法运行时,它不会发送邮件。它现在似乎可以工作了:|不知
1.是否在延迟作业表中创建任务?2.您确定已启动延迟作业辅助进程来处理作业吗?是的,我已重新启动该辅助进程,然后该辅助进程将async_checkout_assist方法添加到表中并成功运行,但当该方法运行时,它不会发送邮件。它现在似乎可以工作了:|不知道,我再次重新启动了应用程序和该辅助进程,似乎是他干的
class ApplicationController < ActionController::Base
async = ApplicationController.new #create new instance
async.async_checkout_assist #call method
def async_checkout_assist
Mailer.delay.mailer_checkout_assist(@contact_name, @contact_email, @contact_tel)
end
end
handle_asynchronously :async_checkout_assist, :run_at => Proc.new { 10.seconds.from_now }
end
SQL (14.1ms) INSERT INTO `delayed_jobs` (`attempts`, `created_at`, `failed_at`, `handler`, `last_error`, `locked_at`, `locked_by`, `priority`, `queue`, `run_at`, `updated_at`) VALUES (0, '2012-05-11 10:14:27', NULL, '--- !ruby/object:Delayed::PerformableMethod\nobject: !ruby/object:ApplicationController\n _routes: !!null \n _action_has_layout: true\n _headers:\n Content-Type: text/html\n _status: 200\n _request: !!null \n _response: !!null \nmethod_name: :async_checkout_assist_without_delay\nargs: []\n', NULL, NULL, NULL, 0, NULL, '2012-05-11 10:14:37', '2012-05-11 10:14:27')
(17.2ms) COMMIT
Marais-Mac-mini:cybercellar.com_heroku davidmuller$ rake jobs:work
[Worker(host:Marais-Mac-mini.local pid:886)] Starting job worker
[Worker(host:Marais-Mac-mini.local pid:886)] ApplicationController#async_checkout_assist_without_delay completed after 9.5160
[Worker(host:Marais-Mac-mini.local pid:886)] Class#mailer_checkout_assist completed after 7.3627
[Worker(host:Marais-Mac-mini.local pid:886)] 2 jobs processed at 0.0923 j/s, 0 failed ...
Mailer.delay.mailer_checkout_assist(@contact_name, @contact_email, @contact_tel)
Mailer.mailer_checkout_assist(@contact_name, @contact_email, @contact_tel).deliver