这是我的代码:
after_commit :notify, on: :create
notify
方法,调用ServiceRequestMailerWorker.perform_async(self.id, email)
,这是我的邮件看起来像:
class ServiceRequestMailerWorker
include Sidekiq::Worker
def perform(service_request_id, send_to)
@service_request = ServiceRequest.find(service_request_id)
@customer = @service_request.customer
WarrantyMailer.submitted(@service_request, @customer, send_to).deliver
end
end
错误:
2014-07-22T03:05:25.626004+00:00 app[worker.1]: 2014-07-22T03:05:25.625Z 2 TID-os0kqm6sg DEBUG: enqueued retry: {"retry":true,"queue":"default","class":"ServiceRequestMailerWorker","args":[787,"email@email.com"],"jid":"f1d8f416718bafa8c809fa3e","enqueued_at":1405998308.4219391,"error_message":"Couldn't find ServiceRequest with 'id'=787 [WHERE (company_id IS NOT NULL)]","error_class":"ActiveRecord::RecordNotFound","failed_at":1405998308.618538,"retry_count":0}
这只发生在Heroku的临时环境中。我一直试图调试这几个小时。其他人遇到这个问题?