Class: Joblin::BackgroundTask::Executor::ExecutorJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
app/models/joblin/background_task/executor.rb

Instance Method Summary collapse

Instance Method Details

#performObject



78
79
80
81
82
83
84
85
# File 'app/models/joblin/background_task/executor.rb', line 78

def perform
  the_task.update(workflow_state: "started") if the_task.workflow_state == "scheduled"
  the_task.perform
rescue InvalidJobError => ex
  the_task.error_message ||= ex.message
  the_task.workflow_state = "failed"
  the_task.save! if the_task.changed?
end

#the_taskObject



87
88
89
90
91
# File 'app/models/joblin/background_task/executor.rb', line 87

def the_task
  @the_task ||= BackgroundTask.find(batch_context[:background_task_id]).tap do |task|
    task.instance_variable_set(:@executor, self)
  end
end