我正在使用延迟作业gem(https://github.com/collectiveidea/delayed_job)让我的邮件程序在后台运行。当我以这种方式使用延迟工作时:
Mailer.delay.order_received(@order)
工作正常。但是当我使用handle_asynchronously时:
def order_received(order)
@order = order
mail to: order.email, subject: "Online Bookstore Order Confirmation"
end
handle_asynchronously :order_received
在我的邮件课上。当我调用order_received方法时,它不起作用。在终端中,它显示
[Worker(host:Joeys-MacBook-Pro.local pid:2915)] Job Delayed::PerformableMethod (id=3) RUNNING
但它永远不会完成这项工作。