Commit 13bac4c2 authored by Shinya Maeda's avatar Shinya Maeda

Use delegate for ref on ci_trigger

parent da8db28d
......@@ -7,6 +7,8 @@ module Ci
belongs_to :project
belongs_to :trigger
delegate :ref, to: :trigger
validates :trigger, presence: true
validates :cron, presence: true
validates :cron_time_zone, presence: true
......
......@@ -5,9 +5,9 @@ class TriggerScheduleWorker
def perform
Ci::TriggerSchedule.where("next_run_at < ?", Time.now).find_each do |trigger_schedule|
begin
Ci::CreateTriggerRequestService.new.execute(trigger_schedule.trigger.project,
Ci::CreateTriggerRequestService.new.execute(trigger_schedule.project,
trigger_schedule.trigger,
trigger_schedule.trigger.ref)
trigger_schedule.ref)
rescue => e
Rails.logger.error "#{trigger_schedule.id}: Failed to trigger_schedule job: #{e.message}"
ensure
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment