Class: Bulkrax::ScheduleRelationshipsJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- Bulkrax::ScheduleRelationshipsJob
- Defined in:
- app/jobs/bulkrax/schedule_relationships_job.rb
Instance Method Summary collapse
Instance Method Details
#perform(importer_id:) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/jobs/bulkrax/schedule_relationships_job.rb', line 5 def perform(importer_id:) importer = Importer.find(importer_id) pending_num = importer.entries.left_outer_joins(:latest_status) .where('bulkrax_statuses.status_message IS NULL ').count return reschedule(importer_id) unless pending_num.zero? importer.last_run.parents.each do |parent_id| Bulkrax.relationship_job_class.constantize.perform_later(parent_identifier: parent_id, importer_run_id: importer.last_run.id) end end |
#reschedule(importer_id) ⇒ Object
17 18 19 20 |
# File 'app/jobs/bulkrax/schedule_relationships_job.rb', line 17 def reschedule(importer_id) ScheduleRelationshipsJob.set(wait: 5.minutes).perform_later(importer_id: importer_id) false end |