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
Léo-Paul Géneau
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
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
13 deletions
+24
-13
app/models/commit_status.rb
app/models/commit_status.rb
+8
-4
app/workers/process_pipeline_worker.rb
app/workers/process_pipeline_worker.rb
+4
-9
app/workers/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