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: import_preview_job.rb
    path of file: ./repos/onebody/app/jobs
    
    the code of the file until where you have to start completion: class ImportPreviewJob < ApplicationJob
  queue_as :import

  def perform(site, import_id)
    ActiveRecord::Base.connection_pool.with_connection do
      Site.with_current(site) do
        import = Import.find(import_id)
        Import.with_advisory_lock("site#{site.id}_import#{import.id}", 0) do
          begin
        
    
  def perform(site, import_id)
    ActiveRecord::Base.connection_pool.with_connection do
      Site.with_current(site) do
        import = Import.find(import_id)
        Import.with_advisory_lock("site#{site.id}_import#{import.id}", 0) do
          begin
            ImportPreview.new(import).preview
          rescue => e
            import.status = :errored
            import.error_message = e.message
            import.save!
          end
        end
      end
    end