Sha256: 8d47359b2d34d1a9bc181d7b5d72d3c37407d1d43f015f969826819542788499

Contents?: true

Size: 1.1 KB

Versions: 12

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

module Bulkrax
  class ImportCollectionJob < ApplicationJob
    queue_as Bulkrax.config.ingest_queue_name

    # rubocop:disable Rails/SkipsModelValidations
    def perform(*args)
      entry = Entry.find(args[0])
      begin
        entry.build
        entry.save!
        ImporterRun.increment_counter(:processed_records, args[1])
        ImporterRun.increment_counter(:processed_collections, args[1])
        ImporterRun.decrement_counter(:enqueued_records, args[1]) unless ImporterRun.find(args[1]).enqueued_records <= 0 # rubocop:disable Style/IdenticalConditionalBranches
      rescue => e
        ImporterRun.increment_counter(:failed_records, args[1])
        ImporterRun.increment_counter(:failed_collections, args[1])
        ImporterRun.decrement_counter(:enqueued_records, args[1]) unless ImporterRun.find(args[1]).enqueued_records <= 0 # rubocop:disable Style/IdenticalConditionalBranches
        raise e
      end
      entry.importer.current_run = ImporterRun.find(args[1])
      entry.importer.record_status
    end
    # rubocop:enable Rails/SkipsModelValidations
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
bulkrax-9.0.2 app/jobs/bulkrax/import_collection_job.rb
bulkrax-9.0.1 app/jobs/bulkrax/import_collection_job.rb
bulkrax-9.0.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-8.2.3 app/jobs/bulkrax/import_collection_job.rb
bulkrax-8.2.2 app/jobs/bulkrax/import_collection_job.rb
bulkrax-8.3.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-8.2.1 app/jobs/bulkrax/import_collection_job.rb
bulkrax-8.2.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-8.1.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-8.0.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-7.0.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-5.5.1 app/jobs/bulkrax/import_collection_job.rb