app/jobs/bulkrax/create_relationships_job.rb in bulkrax-5.4.2 vs app/jobs/bulkrax/create_relationships_job.rb in bulkrax-5.5.0

- old
+ new

@@ -38,11 +38,11 @@ # @see https://github.com/scientist-softserv/louisville-hyku/commit/128a9ef class_attribute :update_child_records_works_file_sets, default: false include DynamicRecordLookup - queue_as Bulkrax.config.ingest_queue_name + queue_as :import # @param parent_identifier [String] Work/Collection ID or Bulkrax::Entry source_identifiers # @param importer_run [Bulkrax::ImporterRun] current importer run (needed to properly update counters) # # The entry_identifier is used to lookup the @base_entry for the job (a.k.a. the entry the job was called from). @@ -96,21 +96,21 @@ errors = ["Parent record not yet available for creating relationships with children records."] end if errors.present? # rubocop:disable Rails/SkipsModelValidations - importer_run.increment!(:failed_relationships, number_of_failures) + ImporterRun.update_counters(importer_run_id, failed_relationships: number_of_failures) # rubocop:enable Rails/SkipsModelValidations parent_entry&.set_status_info(errors.last, importer_run) # TODO: This can create an infinite job cycle, consider a time to live tracker. reschedule({ parent_identifier: parent_identifier, importer_run_id: importer_run_id }) return false # stop current job from continuing to run after rescheduling else # rubocop:disable Rails/SkipsModelValidations - Bulkrax::ImporterRun.find(importer_run_id).increment!(:processed_relationships, number_of_successes) + ImporterRun.update_counters(importer_run_id, processed_relationships: number_of_successes) # rubocop:enable Rails/SkipsModelValidations end end # rubocop:enable Metrics/MethodLength @@ -156,10 +156,11 @@ child_record.file_sets.each(&:update_index) if update_child_records_works_file_sets? && child_record.respond_to?(:file_sets) relationship.destroy end def add_to_collection(child_record, parent_record) - parent_record.try(:reindex_extent=, Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX) + parent_record.try(:reindex_extent=, Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX) if + defined?(Hyrax::Adapters::NestingIndexAdapter) child_record.member_of_collections << parent_record child_record.save! end def add_to_work(child_record, parent_record)