Sha256: eb7f08c34a43d822c2457f60b358ca4af2bec03903038924cbda75d13fad5365

Contents?: true

Size: 727 Bytes

Versions: 32

Compression:

Stored size: 727 Bytes

Contents

# frozen_string_literal: true

module Bulkrax
  class ScheduleRelationshipsJob < ApplicationJob
    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|
        CreateRelationshipsJob.perform_later(parent_identifier: parent_id, importer_run_id: importer.last_run.id)
      end
    end

    def reschedule(importer_id)
      ScheduleRelationshipsJob.set(wait: 5.minutes).perform_later(importer_id: importer_id)
      false
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
bulkrax-4.4.2 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-4.4.1 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-4.3.1 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-5.1.0 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-5.0.0 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-4.4.0 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-4.3.0 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-4.2.1 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-4.2.0 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-4.1.1 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-4.1.0 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-4.0.0 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-3.5.1 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-3.5.0 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-3.4.0 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-3.3.2 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-3.3.1 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-3.3.0 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-3.2.0 app/jobs/bulkrax/schedule_relationships_job.rb
bulkrax-3.1.2 app/jobs/bulkrax/schedule_relationships_job.rb