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