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
Jérome Perrin
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
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
app/models/ci/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