Class: Lcms::Engine::DocumentGenerateJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- Lcms::Engine::DocumentGenerateJob
- Includes:
- RetryDelayed, ResqueJob
- Defined in:
- app/jobs/lcms/engine/document_generate_job.rb
Constant Summary collapse
- WAIT_FOR_JOBS =
%w( Lcms::Engine::MaterialGenerateJob Lcms::Engine::MaterialGeneratePdfJob Lcms::Engine::MaterialGenerateGdocJob ).freeze
Instance Method Summary collapse
Methods included from ResqueJob
included, #result_key, #store_initial_result, #store_result
Instance Method Details
#perform(document, check_queue: false) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/jobs/lcms/engine/document_generate_job.rb', line 17 def perform(document, check_queue: false) @document = document # Job has been queued from Material job if check_queue # Exit if any material is still generating return if elsif document.materials.any? # Queue all materials at the first time create_gdoc_folders return queue_materials end # If came here: # - all materials have been generated # - document doesn't have any materials at all # # So need to check if such job is already running or has been already queued. # And return in such case return if queued? if document.math? document.document_parts.default.each { |p| p.update!(content: EmbedEquations.call(p.content)) } end queue_documents end |