我有这个Resque
后台工作:
class InvestmentNotification
@queue = :investment_email
def self.perform(investment, investors)
puts "Notify about #{investment['name']}"
investors.each do |investor|
puts "Notify #{investor['name']}"
mailer = InvestmentMailer.notify_about_updates(investment, investor)
puts 'Mailer set up'
mailer.deliver_now
puts 'Mail delivered'
end
puts 'Delivered all emails'
end
end
问题在于,当我排队工作时,一切顺利,直到mailer.deliver_now
。 deliver_now
只是不做任何事情并阻塞整个队列。 puts 'Mail delivered'
- 此代码永远不会执行。
如何解决此问题并在Resque
内发送电子邮件?