Class: IiifPrint::Jobs::CreateRelationshipsJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- IiifPrint::Jobs::CreateRelationshipsJob
- Defined in:
- lib/iiif_print/jobs/create_relationships_job.rb
Overview
Break a pdf into individual pages
Instance Method Summary collapse
-
#perform(user:, parent_id:, parent_model:, child_model:) ⇒ Object
Link newly created child works to the parent.
Instance Method Details
#perform(user:, parent_id:, parent_model:, child_model:) ⇒ Object
Link newly created child works to the parent
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/iiif_print/jobs/create_relationships_job.rb', line 10 def perform(user:, parent_id:, parent_model:, child_model:) if completed_child_data_for(parent_id, child_model) # add the members parent_work = parent_model.constantize.find(parent_id) create_relationships(user: user, parent: parent_work, ordered_children: @child_works) @pending_children.each(&:destroy) else # reschedule the job and end this one normally # # TODO: Depending on how things shake out, we could be infinitely rescheduling this job. # Consider a time to live parameter. reschedule(user: user, parent_id: parent_id, parent_model: parent_model, child_model: child_model) end end |