Use delegate for ref on ci_trigger
This commit is contained in:
parent
da8db28d17
commit
13bac4c252
2 changed files with 4 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue