Class: TimeoutFailedTasksJob

Inherits:
ContainerBrokerBaseJob show all
Defined in:
app/jobs/timeout_failed_tasks_job.rb

Constant Summary

Constants inherited from ContainerBrokerBaseJob

ContainerBrokerBaseJob::JOB_METRIC

Instance Method Summary collapse

Methods inherited from ContainerBrokerBaseJob

request_id_from_args

Instance Method Details

#failed_tasks_to_timeoutObject



20
21
22
# File 'app/jobs/timeout_failed_tasks_job.rb', line 20

def failed_tasks_to_timeout
  Task.failed.where(:finished_at.lt => Time.current - Settings.timeout_tasks_after_hours)
end

#perform(*_args) ⇒ Object



6
7
8
# File 'app/jobs/timeout_failed_tasks_job.rb', line 6

def perform(*_args)
  timeout_failed_tasks
end

#timeout_failed_tasksObject



10
11
12
13
14
15
16
17
18
# File 'app/jobs/timeout_failed_tasks_job.rb', line 10

def timeout_failed_tasks
  failed_tasks_to_timeout.map do |task|
    Rails.logger.debug("Marking task as error due to timeout: #{task.uuid}")

    task.error!

    persist_logs(task)
  end
end