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
83059f13
Commit
83059f13
authored
Oct 03, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve pipeline optimistic locking implementation
parent
7db9323d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
pipeline.rb
app/models/ci/pipeline.rb
+3
-2
No files found.
app/models/ci/pipeline.rb
View file @
83059f13
...
@@ -5,6 +5,7 @@ module Ci
...
@@ -5,6 +5,7 @@ module Ci
include
Importable
include
Importable
include
AfterCommitQueue
include
AfterCommitQueue
include
Presentable
include
Presentable
include
Gitlab
::
OptimisticLocking
belongs_to
:project
belongs_to
:project
belongs_to
:user
belongs_to
:user
...
@@ -274,7 +275,7 @@ module Ci
...
@@ -274,7 +275,7 @@ module Ci
end
end
def
cancel_running
def
cancel_running
Gitlab
::
OptimisticLocking
.
retry
_lock
(
cancelable_statuses
)
do
|
cancelable
|
retry_optimistic
_lock
(
cancelable_statuses
)
do
|
cancelable
|
cancelable
.
find_each
do
|
job
|
cancelable
.
find_each
do
|
job
|
yield
(
job
)
if
block_given?
yield
(
job
)
if
block_given?
job
.
cancel
job
.
cancel
...
@@ -418,7 +419,7 @@ module Ci
...
@@ -418,7 +419,7 @@ module Ci
end
end
def
update_status
def
update_status
Gitlab
::
OptimisticLocking
.
retry
_lock
(
self
)
do
retry_optimistic
_lock
(
self
)
do
case
latest_builds_status
case
latest_builds_status
when
'pending'
then
enqueue
when
'pending'
then
enqueue
when
'running'
then
run
when
'running'
then
run
...
...
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