Sha256: 1b595330446c8d4ca511fbfc6139c6a9c7dc8bcdb486caf7f9241b6a61c45358
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true module Bulkrax class ExportWorkJob < ApplicationJob queue_as :export def perform(*args) entry = Entry.find(args[0]) begin entry.build entry.save rescue StandardError # rubocop:disable Rails/SkipsModelValidations ExporterRun.find(args[1]).increment!(:failed_records) ExporterRun.find(args[1]).decrement!(:enqueued_records) raise else if entry.failed? ExporterRun.find(args[1]).increment!(:failed_records) ExporterRun.find(args[1]).decrement!(:enqueued_records) raise entry.reload.current_status.error_class.constantize else ExporterRun.find(args[1]).increment!(:processed_records) ExporterRun.find(args[1]).decrement!(:enqueued_records) end # rubocop:enable Rails/SkipsModelValidations end exporter_run = ExporterRun.find(args[1]) return if exporter_run.enqueued_records.positive? if exporter_run.failed_records.positive? exporter_run.exporter.status_info('Complete (with failures)') else exporter_run.exporter.status_info('Complete') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bulkrax-1.0.2 | app/jobs/bulkrax/export_work_job.rb |
bulkrax-1.0.1 | app/jobs/bulkrax/export_work_job.rb |
bulkrax-1.0.0 | app/jobs/bulkrax/export_work_job.rb |