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
Post a Comment