ruby on rails - Passing instance variables into delayed job -


i'm trying use delayed_jobs (background workers) process incoming email.

class emailprocessor    def initialize(email)     @raw_html = email.raw_html     @subject = email.subject   end    def process     @raw_html & @subject   end   handle_asynchronously :process, :priority => 20  end 

the problem can't pass instance variables (@raw_html & @subject) delayed jobs. delayed jobs requests save data model retrieved in background task, prefer have background worker complete entire task (including saving record).

any thoughts?

use delay pass params method want run in background:

class emailprocessor    def self.process(email)     # email   end end  # somewhere down line:  emailprocessor.delay.process(email) 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -