Sha256: 4fe734dc7c03c472faaeebe275fcb17e56769b04da388716cf0e019174feefaf

Contents?: true

Size: 1.06 KB

Versions: 26

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

module Bulkrax
  class ImportCollectionJob < ApplicationJob
    queue_as :import

    # rubocop:disable Rails/SkipsModelValidations
    def perform(*args)
      entry = Entry.find(args[0])
      begin
        entry.build
        entry.save!
        ImporterRun.find(args[1]).increment!(:processed_records)
        ImporterRun.find(args[1]).increment!(:processed_collections)
        ImporterRun.find(args[1]).decrement!(:enqueued_records) unless ImporterRun.find(args[1]).enqueued_records <= 0 # rubocop:disable Style/IdenticalConditionalBranches
      rescue => e
        ImporterRun.find(args[1]).increment!(:failed_records)
        ImporterRun.find(args[1]).increment!(:failed_collections)
        ImporterRun.find(args[1]).decrement!(:enqueued_records) 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

26 entries across 26 versions & 1 rubygems

Version Path
bulkrax-5.4.1 app/jobs/bulkrax/import_collection_job.rb
bulkrax-5.4.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-5.3.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-5.2.1 app/jobs/bulkrax/import_collection_job.rb
bulkrax-4.4.2 app/jobs/bulkrax/import_collection_job.rb
bulkrax-5.2.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-4.4.1 app/jobs/bulkrax/import_collection_job.rb
bulkrax-4.3.1 app/jobs/bulkrax/import_collection_job.rb
bulkrax-5.1.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-5.0.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-4.4.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-4.3.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-4.2.1 app/jobs/bulkrax/import_collection_job.rb
bulkrax-4.2.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-4.1.1 app/jobs/bulkrax/import_collection_job.rb
bulkrax-4.1.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-4.0.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-3.5.1 app/jobs/bulkrax/import_collection_job.rb
bulkrax-3.5.0 app/jobs/bulkrax/import_collection_job.rb
bulkrax-3.4.0 app/jobs/bulkrax/import_collection_job.rb