module RailsIron::Worker

Attributes

iron_task_id[RW]
params[R]

InstanceMethods

Public Class Methods

included(base) click to toggle source
# File lib/rails_iron/worker.rb, line 5
def self.included(base)
  base.extend(ClassMethods)
end

Public Instance Methods

params=(params) click to toggle source
# File lib/rails_iron/worker.rb, line 40
def params=(params)
  raise RailsIron::PermanentError, "Expected #{params} to be an Array" unless params.is_a?(Array)
  @params = params
end
rerun() click to toggle source
# File lib/rails_iron/worker.rb, line 45
def rerun
  self.class.iron_worker.tasks.retry(iron_task_id, delay: 300)
end
run() click to toggle source
# File lib/rails_iron/worker.rb, line 31
def run
  begin
    perform(*params)
  rescue RailsIron::TemporaryError
    puts "TemporaryError raised, will retry task after 300 seconds"
    rerun
  end
end