Sha256: 450b62c4d4797dba378380b36cc830855f9036c531e176376dfc223d38a19116

Contents?: true

Size: 695 Bytes

Versions: 5

Compression:

Stored size: 695 Bytes

Contents

# frozen_string_literal: true
module ActiveEncode
  class PollingJob < ActiveJob::Base
    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

5 entries across 5 versions & 1 rubygems

Version Path
active_encode-0.8.2 app/jobs/active_encode/polling_job.rb
active_encode-0.8.1 app/jobs/active_encode/polling_job.rb
active_encode-0.8.0 app/jobs/active_encode/polling_job.rb
active_encode-0.7.0 app/jobs/active_encode/polling_job.rb
active_encode-0.6.0 app/jobs/active_encode/polling_job.rb