Sha256: aa10652efdfe7fe53fc5df0de5e547d1f2680294dd6c4b3bf5a6b974057d17f8

Contents?: true

Size: 694 Bytes

Versions: 9

Compression:

Stored size: 694 Bytes

Contents

# frozen_string_literal: true
module ActiveEncode
  class PollingJob < ApplicationJob
    def perform(encode)
      encode.run_callbacks(:status_update) { encode }
      case encode.state
      when :failed
        encode.run_callbacks(:failed) { encode }
      when :cancelled
        encode.run_callbacks(:cancelled) { encode }
      when :completed
        encode.run_callbacks(:completed) { encode }
      when :running
        ActiveEncode::PollingJob.set(wait: ActiveEncode::Polling::POLLING_WAIT_TIME).perform_later(encode)
      else # other states are illegal and ignored
        raise StandardError, "Illegal state #{encode.state} in encode #{encode.id}!"
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
active_encode-1.2.3 app/jobs/active_encode/polling_job.rb
active_encode-1.2.2 app/jobs/active_encode/polling_job.rb
active_encode-1.2.1 app/jobs/active_encode/polling_job.rb
active_encode-1.2.0 app/jobs/active_encode/polling_job.rb
active_encode-1.1.3 app/jobs/active_encode/polling_job.rb
active_encode-1.1.2 app/jobs/active_encode/polling_job.rb
active_encode-1.1.1 app/jobs/active_encode/polling_job.rb
active_encode-1.1.0 app/jobs/active_encode/polling_job.rb
active_encode-1.0.0 app/jobs/active_encode/polling_job.rb