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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
68891961
Commit
68891961
authored
Sep 02, 2019
by
Sean Carroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport EE issue 12996
parent
937b2027
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+4
-4
lib/gitlab/optimistic_locking.rb
lib/gitlab/optimistic_locking.rb
+2
-1
No files found.
app/models/ci/pipeline.rb
View file @
68891961
...
...
@@ -460,8 +460,8 @@ module Ci
canceled?
&&
auto_canceled_by_id?
end
def
cancel_running
retry_optimistic_lock
(
cancelable_statuses
)
do
|
cancelable
|
def
cancel_running
(
retries:
nil
)
retry_optimistic_lock
(
cancelable_statuses
,
retries
)
do
|
cancelable
|
cancelable
.
find_each
do
|
job
|
yield
(
job
)
if
block_given?
job
.
cancel
...
...
@@ -469,10 +469,10 @@ module Ci
end
end
def
auto_cancel_running
(
pipeline
)
def
auto_cancel_running
(
pipeline
,
retries:
nil
)
update
(
auto_canceled_by:
pipeline
)
cancel_running
do
|
job
|
cancel_running
(
retries:
retries
)
do
|
job
|
job
.
auto_canceled_by
=
pipeline
end
end
...
...
lib/gitlab/optimistic_locking.rb
View file @
68891961
...
...
@@ -4,7 +4,8 @@ module Gitlab
module
OptimisticLocking
module_function
def
retry_lock
(
subject
,
retries
=
100
,
&
block
)
def
retry_lock
(
subject
,
retries
=
nil
,
&
block
)
retries
||=
100
# TODO(Observability): We should be recording details of the number of retries and the duration of the total execution here
ActiveRecord
::
Base
.
transaction
do
yield
(
subject
)
...
...
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