Class: Spotlight::ChangeVisibilityJob
- Inherits:
 - 
      ApplicationJob
      
        
- Object
 - ActiveJob::Base
 - ApplicationJob
 - Spotlight::ChangeVisibilityJob
 
 
- Includes:
 - GatherDocuments, JobTracking
 
- Defined in:
 - app/jobs/spotlight/change_visibility_job.rb
 
Instance Method Summary collapse
- 
  
    
      #perform(solr_params:, exhibit:, visibility:)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
rubocop:disable Metrics/MethodLength.
 
Methods included from GatherDocuments
Methods included from JobTracking
#finalize_job_tracker!, #initialize_job_tracker!, #job_tracker, #mark_job_as_failed!
Instance Method Details
#perform(solr_params:, exhibit:, visibility:) ⇒ Object
rubocop:disable Metrics/MethodLength
      11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  | 
    
      # File 'app/jobs/spotlight/change_visibility_job.rb', line 11 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:, 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:, message: "#{progress.progress} of #{progress.total} (#{@errors} errors)") end  |