blob: 5c2f03dee79f31599a1166821fd68191bea4365a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
class ScheduledTriggerWorker
include Sidekiq::Worker
include CronjobQueue
def perform
Ci::ScheduledTrigger.where("next_run_at < ?", Time.now).find_each do |trigger|
begin
Ci::CreatePipelineService.new(trigger.project, trigger.owner, ref: trigger.ref).
execute(ignore_skip_ci: true, scheduled_trigger: true)
rescue => e
Rails.logger.error "#{trigger.id}: Failed to trigger job: #{e.message}"
ensure
trigger.schedule_next_run!
trigger.update_last_run!
end
end
end
end
|