Module: ResqueJob
- Included in:
- Lcms::Engine::DocumentBundleGenerateJob, Lcms::Engine::DocumentGenerateGdocJob, Lcms::Engine::DocumentGenerateJob, Lcms::Engine::DocumentGeneratePdfJob, Lcms::Engine::DocumentParseJob, Lcms::Engine::MaterialGenerateGdocJob, Lcms::Engine::MaterialGenerateJob, Lcms::Engine::MaterialGeneratePdfJob, Lcms::Engine::MaterialParseJob
- Defined in:
- lib/resque_job.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
:nodoc:.
Instance Method Summary collapse
- #result_key ⇒ Object
- #store_initial_result(res, options = {}) ⇒ Object
- #store_result(res, options = {}) ⇒ Object
Class Method Details
.included(base) ⇒ Object
:nodoc:
4 5 6 |
# File 'lib/resque_job.rb', line 4 def self.included(base) # :nodoc: base.extend ClassMethods end |
Instance Method Details
#result_key ⇒ Object
69 70 71 |
# File 'lib/resque_job.rb', line 69 def result_key @result_key ||= self.class.result_key(job_id) end |
#store_initial_result(res, options = {}) ⇒ Object
73 74 75 76 |
# File 'lib/resque_job.rb', line 73 def store_initial_result(res, = {}) key = self.class.result_key([:initial_job_id].presence || job_id) Resque.redis.set(key, res.to_json, ex: 1.hour.to_i) end |
#store_result(res, options = {}) ⇒ Object
78 79 80 81 82 83 84 85 86 |
# File 'lib/resque_job.rb', line 78 def store_result(res, = {}) key = if (jid = [:initial_job_id]).blank? result_key else # store result with parent job id to retrieve the result later knowing only parent job id [Resque.redis.namespace, 'result', self.class.name.underscore, jid, job_id].join(':') end Resque.redis.set(key, res.to_json, ex: 1.hour.to_i) end |