简体   繁体   English

ActionMailer观察者无法使用delay_job

[英]ActionMailer observers not working with delayed_job

I have an ActionMailer observer that's working just fine during normal sends, but when I send the delivery to delayed_job, it doesn't get called at all. 我有一个ActionMailer观察器,在正常发送期间工作正常,但是当我将传递发送到delay_job时,根本没有调用它。 Is this a function of delayed_job itself, or something specific with my observer? 这是delay_job本身的功能,还是我的观察者所特有的功能?

Controller: 控制器:

BulkMailer.delay.blast(recipients, email, template)

Initializer: 初始化:

ActionMailer::Base.register_observer(MailObserver)

Observer 观察

class MailObserver
  def self.delivered_email(message)
    Rails.logger.debug 'Message: finished'
  end
end

The code itself was fine, Delayed Job and ActionMailer observers are compatible. 代码本身很好,Delayed Job和ActionMailer观察器兼容。 My problem was solved by restarting the workers. 我的问题通过重新启动工作程序得以解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM