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
47475322
Commit
47475322
authored
Sep 28, 2020
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a custom exception used with build trace locking
parent
e7f22619
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
1 deletion
+4
-1
lib/gitlab/ci/trace.rb
lib/gitlab/ci/trace.rb
+3
-0
spec/lib/gitlab/ci/trace_spec.rb
spec/lib/gitlab/ci/trace_spec.rb
+1
-1
No files found.
lib/gitlab/ci/trace.rb
View file @
47475322
...
@@ -16,6 +16,7 @@ module Gitlab
...
@@ -16,6 +16,7 @@ module Gitlab
ArchiveError
=
Class
.
new
(
StandardError
)
ArchiveError
=
Class
.
new
(
StandardError
)
AlreadyArchivedError
=
Class
.
new
(
StandardError
)
AlreadyArchivedError
=
Class
.
new
(
StandardError
)
LockedError
=
Class
.
new
(
StandardError
)
attr_reader
:job
attr_reader
:job
...
@@ -132,6 +133,8 @@ module Gitlab
...
@@ -132,6 +133,8 @@ module Gitlab
def
lock
(
&
block
)
def
lock
(
&
block
)
in_write_lock
(
&
block
)
in_write_lock
(
&
block
)
rescue
FailedToObtainLockError
raise
LockedError
,
"build trace `
#{
job
.
id
}
` is locked"
end
end
private
private
...
...
spec/lib/gitlab/ci/trace_spec.rb
View file @
47475322
...
@@ -116,7 +116,7 @@ RSpec.describe Gitlab::Ci::Trace, :clean_gitlab_redis_shared_state do
...
@@ -116,7 +116,7 @@ RSpec.describe Gitlab::Ci::Trace, :clean_gitlab_redis_shared_state do
it
'acquires an exclusive lease on the trace'
do
it
'acquires an exclusive lease on the trace'
do
trace
.
lock
do
trace
.
lock
do
expect
{
trace
.
lock
}
expect
{
trace
.
lock
}
.
to
raise_error
::
Gitlab
::
ExclusiveLeaseHelpers
::
FailedToObtainLock
Error
.
to
raise_error
described_class
::
Locked
Error
end
end
end
end
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