Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
13bac4c2
Commit
13bac4c2
authored
Mar 30, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use delegate for ref on ci_trigger
parent
da8db28d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
app/models/ci/trigger_schedule.rb
app/models/ci/trigger_schedule.rb
+2
-0
app/workers/trigger_schedule_worker.rb
app/workers/trigger_schedule_worker.rb
+2
-2
No files found.
app/models/ci/trigger_schedule.rb
View file @
13bac4c2
...
@@ -7,6 +7,8 @@ module Ci
...
@@ -7,6 +7,8 @@ module Ci
belongs_to
:project
belongs_to
:project
belongs_to
:trigger
belongs_to
:trigger
delegate
:ref
,
to: :trigger
validates
:trigger
,
presence:
true
validates
:trigger
,
presence:
true
validates
:cron
,
presence:
true
validates
:cron
,
presence:
true
validates
:cron_time_zone
,
presence:
true
validates
:cron_time_zone
,
presence:
true
...
...
app/workers/trigger_schedule_worker.rb
View file @
13bac4c2
...
@@ -5,9 +5,9 @@ class TriggerScheduleWorker
...
@@ -5,9 +5,9 @@ class TriggerScheduleWorker
def
perform
def
perform
Ci
::
TriggerSchedule
.
where
(
"next_run_at < ?"
,
Time
.
now
).
find_each
do
|
trigger_schedule
|
Ci
::
TriggerSchedule
.
where
(
"next_run_at < ?"
,
Time
.
now
).
find_each
do
|
trigger_schedule
|
begin
begin
Ci
::
CreateTriggerRequestService
.
new
.
execute
(
trigger_schedule
.
trigger
.
project
,
Ci
::
CreateTriggerRequestService
.
new
.
execute
(
trigger_schedule
.
project
,
trigger_schedule
.
trigger
,
trigger_schedule
.
trigger
,
trigger_schedule
.
trigger
.
ref
)
trigger_schedule
.
ref
)
rescue
=>
e
rescue
=>
e
Rails
.
logger
.
error
"
#{
trigger_schedule
.
id
}
: Failed to trigger_schedule job:
#{
e
.
message
}
"
Rails
.
logger
.
error
"
#{
trigger_schedule
.
id
}
: Failed to trigger_schedule job:
#{
e
.
message
}
"
ensure
ensure
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment