Sha256: 26ffcf7cc57021ecfaec8509cc12eb1b32943b9aff3ed702d0da5c88758d67b8
Contents?: true
Size: 1.08 KB
Versions: 39
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module Spotlight ### class ChangeVisibilityJob < Spotlight::ApplicationJob include Spotlight::JobTracking include Spotlight::GatherDocuments with_job_tracking(resource: ->(job) { job.arguments.last[:exhibit] }) # rubocop:disable Metrics/MethodLength def perform(solr_params:, exhibit:, visibility:, **) @errors = 0 each_document(solr_params, exhibit) do |document| case visibility when 'public' document.make_public!(exhibit) when 'private' document.make_private!(exhibit) end document.reindex(update_params: {}) progress&.increment rescue StandardError => e job_tracker.append_log_entry(type: :error, exhibit: exhibit, message: e.to_s) @errors += 1 mark_job_as_failed! end exhibit.blacklight_config.repository.connection.commit job_tracker.append_log_entry(type: :info, exhibit: exhibit, message: "#{progress.progress} of #{progress.total} (#{@errors} errors)") end # rubocop:enable Metrics/MethodLength end end
Version data entries
39 entries across 39 versions & 1 rubygems