8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/foreman_rh_cloud/engine.rb', line 8
def self.register_scheduled_task(task_class, cronline)
ForemanTasks::RecurringLogic.transaction(isolation: :serializable) do
return if ForemanTasks::RecurringLogic.joins(:tasks)
.merge(ForemanTasks::Task.where(label: task_class.name))
.exists?
User.as_anonymous_admin do
recurring_logic = ForemanTasks::RecurringLogic.new_from_cronline(cronline)
recurring_logic.save!
recurring_logic.start(task_class)
end
end
rescue ActiveRecord::TransactionIsolationError
end
|