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
487fda4d
Commit
487fda4d
authored
Nov 13, 2020
by
Lucas Charles
Committed by
Ash McKenzie
Nov 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Ruby 2.7 deprecations
Relates to
https://gitlab.com/gitlab-org/gitlab/-/issues/257438
parent
a5032437
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
app/models/ci/build_trace_chunk.rb
app/models/ci/build_trace_chunk.rb
+11
-6
No files found.
app/models/ci/build_trace_chunk.rb
View file @
487fda4d
...
@@ -105,7 +105,7 @@ module Ci
...
@@ -105,7 +105,7 @@ module Ci
raise
ArgumentError
,
'Offset is out of range'
if
offset
<
0
||
offset
>
size
raise
ArgumentError
,
'Offset is out of range'
if
offset
<
0
||
offset
>
size
raise
ArgumentError
,
'Chunk size overflow'
if
CHUNK_SIZE
<
(
offset
+
new_data
.
bytesize
)
raise
ArgumentError
,
'Chunk size overflow'
if
CHUNK_SIZE
<
(
offset
+
new_data
.
bytesize
)
in_lock
(
*
lock_params
)
{
unsafe_append_data!
(
new_data
,
offset
)
}
in_lock
(
lock_key
,
*
*
lock_params
)
{
unsafe_append_data!
(
new_data
,
offset
)
}
schedule_to_persist!
if
full?
schedule_to_persist!
if
full?
end
end
...
@@ -151,7 +151,7 @@ module Ci
...
@@ -151,7 +151,7 @@ module Ci
# acquired
# acquired
#
#
def
persist_data!
def
persist_data!
in_lock
(
*
lock_params
)
do
# exclusive Redis lock is acquired first
in_lock
(
lock_key
,
**
lock_params
)
do
# exclusive Redis lock is acquired first
raise
FailedToPersistDataError
,
'Modifed build trace chunk detected'
if
has_changes_to_save?
raise
FailedToPersistDataError
,
'Modifed build trace chunk detected'
if
has_changes_to_save?
self
.
reset
.
then
do
|
chunk
|
# we ensure having latest lock_version
self
.
reset
.
then
do
|
chunk
|
# we ensure having latest lock_version
...
@@ -289,11 +289,16 @@ module Ci
...
@@ -289,11 +289,16 @@ module Ci
build
.
trace_chunks
.
maximum
(
:chunk_index
).
to_i
build
.
trace_chunks
.
maximum
(
:chunk_index
).
to_i
end
end
def
lock_key
"trace_write:
#{
build_id
}
:chunks:
#{
chunk_index
}
"
end
def
lock_params
def
lock_params
[
"trace_write:
#{
build_id
}
:chunks:
#{
chunk_index
}
"
,
{
{
ttl:
WRITE_LOCK_TTL
,
ttl:
WRITE_LOCK_TTL
,
retries:
WRITE_LOCK_RETRY
,
retries:
WRITE_LOCK_RETRY
,
sleep_sec:
WRITE_LOCK_SLEEP
}]
sleep_sec:
WRITE_LOCK_SLEEP
}
end
end
def
metrics
def
metrics
...
...
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