BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7d4767fb
Commit
7d4767fb
authored
Oct 03, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract updating pipeline status to async worker
parent
57863874
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
13 deletions
+24
-13
commit_status.rb
app/models/commit_status.rb
+8
-4
process_pipeline_worker.rb
app/workers/process_pipeline_worker.rb
+4
-9
update_pipeline_worker.rb
app/workers/update_pipeline_worker.rb
+12
-0
No files found.
app/models/commit_status.rb
View file @
7d4767fb
...
...
@@ -78,10 +78,14 @@ class CommitStatus < ActiveRecord::Base
end
after_transition
do
|
commit_status
,
transition
|
if
commit_status
.
pipeline
&&
!
transition
.
loopback?
ProcessPipelineWorker
.
perform_async
(
commit_status
.
pipeline
.
id
,
process:
commit_status
.
complete?
)
return
if
transition
.
loopback?
commit_status
.
pipeline
.
try
(
:id
).
try
do
|
pipeline_id
|
if
commit_status
.
complete?
ProcessPipelineWorker
.
perform_async
(
pipeline_id
)
end
UpdatePipelineWorker
.
perform_async
(
pipeline_id
)
end
true
...
...
app/workers/process_pipeline_worker.rb
View file @
7d4767fb
...
...
@@ -3,15 +3,10 @@ class ProcessPipelineWorker
sidekiq_options
queue: :default
def
perform
(
pipeline_id
,
params
)
begin
pipeline
=
Ci
::
Pipeline
.
find
(
pipeline_id
)
rescue
ActiveRecord
::
RecordNotFound
return
end
def
perform
(
pipeline_id
)
pipeline
=
Ci
::
Pipeline
.
find_by
(
id:
pipeline_id
)
return
unless
pipeline
pipeline
.
process!
if
params
[
'process'
]
pipeline
.
update_status
pipeline
.
process!
end
end
app/workers/update_pipeline_worker.rb
0 → 100644
View file @
7d4767fb
class
UpdatePipelineWorker
include
Sidekiq
::
Worker
sidekiq_options
queue: :default
def
perform
(
pipeline_id
)
pipeline
=
Ci
::
Pipeline
.
find_by
(
id:
pipeline_id
)
return
unless
pipeline
pipeline
.
update_status
end
end
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