app/models/scheduled_task.rb in tasks_scheduler-0.4.2 vs app/models/scheduled_task.rb in tasks_scheduler-0.5.0

- old
+ new

@@ -1,7 +1,8 @@ # frozen_string_literal: true +require 'eac_ruby_utils/core_ext' require 'rake' class ScheduledTask < ActiveRecord::Base include ::ScheduledTask::Checker include ::ScheduledTask::Log @@ -27,17 +28,14 @@ DEFAULT_TIMEOUT end end end - STATUS_RUNNING = 'running' - STATUS_FAILED = 'failed' - STATUS_WAITING = 'waiting' - STATUS_ABORTED = 'aborted' - STATUS_TIMEOUT = 'timeout' - STATUS_DISABLED = 'disabled' + enable_listable + lists.add_string :status, 'aborted', 'disabled', 'failed', 'running', 'task_not_found', 'timeout', + 'waiting' - LAST_FAIL_STATUSES = [STATUS_FAILED, STATUS_ABORTED, STATUS_TIMEOUT].freeze + LAST_FAIL_STATUSES = [STATUS_FAILED, STATUS_ABORTED, STATUS_TASK_NOT_FOUND, STATUS_TIMEOUT].freeze validates :scheduling, presence: true, 'tasks_scheduler/cron_scheduling': true validates :task, presence: true validates :last_fail_status, allow_blank: true, inclusion: { in: LAST_FAIL_STATUSES }