You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: reindex_job.rb
    path of file: ./repos/spotlight/app/jobs/spotlight
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Spotlight
  ##
  # Reindex the given resources or exhibits
  class ReindexJob < Spotlight::ApplicationJob
    include Spotlight::JobTracking
    with_job_tracking(resource: ->(job) { job.exhibit })

    include Spotlight::LimitConcurrency

    before_perform do |job|
      pagination = job.argu
    
    def perform(exhibit_or_resources, start: nil, finish: nil, **)
      errors = 0

      error_handler = lambda do |pipeline, exception, _data|
        job_tracker.append_log_entry(
          type: :error,
          exhibit: exhibit,
          message: exception.to_s,
          backtrace: exception.backtrace.first(5).join("\n"),
          resource_id: (pipeline.source.id if pipeline.source.respond_to?(:id))
        )
        mark_job_as_failed!
        errors += 1
      end

      resource_list(exhibit_or_resources, start: start, finish: finish).each do |resource|
        resource.reindex(touch: false, commit: false, job_tracker: job_tracker, additional_data: job_data, on_error: error_handler) do |*|
          progress&.increment
        end
      rescue StandardError => e
        error_handler.call(Struct.new(:source).new(resource), e, nil)
      end

      job_tracker.append_log_entry(
        type: :summary,
        exhibit: exhibit,
        message: I18n.t(
          'spotlight.job_trackers.show.messages.status.in_progress',
          progress: progress.progress,
          total: progress.total,
          errors: (I18n.t('spotlight.job_trackers.show.messages.errors', count: errors) if errors.positive?)
        ),
        progress: progress.progress, total: progress.total, errors: errors
      )
    end