Resque

时间:2016-04-28 09:50:15

标签: ruby-on-rails ruby redis actionmailer resque

我有这个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_nowdeliver_now只是不做任何事情并阻塞整个队列。 puts 'Mail delivered' - 此代码永远不会执行。

如何解决此问题并在Resque内发送电子邮件?

0 个答案:

没有答案