Sha256: 30621076973356c9829dbd5e8812ecf2549b2e653bc54786b75694f212401d01

Contents?: true

Size: 578 Bytes

Versions: 38

Compression:

Stored size: 578 Bytes

Contents

module Pageflow
  class ProcessImageOrTextTrackJob < ApplicationJob
    queue_as :resizing

    include StateMachineJob

    def perform_with_result(file, _options)
      file.attachment.reprocess!

      if file.valid?
        :ok
      else
        reset_invalid_attachment(file)
        :error
      end
    rescue ActiveRecord::RecordInvalid, Errno::ENAMETOOLONG
      reset_invalid_attachment(file)

      :error
    end

    def reset_invalid_attachment(file)
      file_name = file.file_name
      file.attachment = nil
      file.file_name = file_name
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
pageflow-17.0.4 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-17.0.3 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-17.0.2 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-17.0.1 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-17.0.0 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-16.2.0 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-16.1.0 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-16.0.0 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-15.8.0 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-15.7.1 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-15.7.0 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-15.6.1 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-15.6.0 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-15.5.0 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-15.4.0 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-15.3.0 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-15.2.2 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-15.2.1 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-15.2.0 app/jobs/pageflow/process_image_or_text_track_job.rb
pageflow-15.1.2 app/jobs/pageflow/process_image_or_text_track_job.rb