Sha256: b71a9c3b1ba4c4a2e822b7ad0b0ca15764db559f4f959badd973d2960026365a
Contents?: true
Size: 938 Bytes
Versions: 24
Compression:
Stored size: 938 Bytes
Contents
namespace :foreman_tasks do desc <<~DESC Reschedules the long running task checker recurring logic to run at a different schedule. ENV variables: * FOREMAN_TASKS_CHECK_LONG_RUNNING_TASKS_CRONLINE : A cron line describing the schedule, defaults to 0 0 * * * DESC task :reschedule_long_running_tasks_checker => ['environment', 'dynflow:client'] do User.as_anonymous_admin do task_class = Actions::CheckLongRunningTasks cronline = ENV['FOREMAN_TASKS_CHECK_LONG_RUNNING_TASKS_CRONLINE'] || '0 0 * * *' rl = ForemanTasks::RecurringLogic.joins(:tasks) .where(state: 'active') .merge(ForemanTasks::Task.where(label: task_class.name)) .first if rl&.cron_line != cronline rl.cancel ForemanTasks.register_scheduled_task(task_class, cronline) end end end end
Version data entries
24 entries across 24 versions & 1 rubygems