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
49467379
Commit
49467379
authored
Jun 18, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename persisted? to data_persisted?
parent
71e30c01
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
14 deletions
+10
-14
app/models/ci/build_trace_chunk.rb
app/models/ci/build_trace_chunk.rb
+7
-11
app/workers/ci/build_trace_chunk_flush_worker.rb
app/workers/ci/build_trace_chunk_flush_worker.rb
+1
-1
spec/models/ci/build_trace_chunk_spec.rb
spec/models/ci/build_trace_chunk_spec.rb
+2
-2
No files found.
app/models/ci/build_trace_chunk.rb
View file @
49467379
...
...
@@ -75,9 +75,7 @@ module Ci
raise
ArgumentError
,
'Offset is out of range'
if
offset
>
size
||
offset
<
0
raise
ArgumentError
,
'Chunk size overflow'
if
CHUNK_SIZE
<
(
offset
+
new_data
.
bytesize
)
in_lock
(
*
lock_params
)
do
self
.
reload
if
self
.
persisted?
in_lock
(
*
lock_params
)
do
# Write opetation is atomic
unsafe_set_data!
(
data
.
byteslice
(
0
,
offset
)
+
new_data
)
end
...
...
@@ -100,21 +98,19 @@ module Ci
(
start_offset
...
end_offset
)
end
def
persisted?
def
data_
persisted?
!
redis?
end
def
persist!
in_lock
(
*
lock_params
)
do
self
.
reload
if
self
.
persisted?
unsafe_move_to!
(
self
.
class
.
persist_store
)
def
persist_data!
in_lock
(
*
lock_params
)
do
# Write opetation is atomic
unsafe_migrate_to!
(
self
.
class
.
persist_store
)
end
end
private
def
unsafe_m
ov
e_to!
(
new_store
)
def
unsafe_m
igrat
e_to!
(
new_store
)
return
if
data_store
==
new_store
.
to_s
return
unless
size
>
0
...
...
@@ -143,7 +139,7 @@ module Ci
end
def
schedule_to_persist
return
if
persisted?
return
if
data_
persisted?
Ci
::
BuildTraceChunkFlushWorker
.
perform_async
(
id
)
end
...
...
app/workers/ci/build_trace_chunk_flush_worker.rb
View file @
49467379
...
...
@@ -5,7 +5,7 @@ module Ci
def
perform
(
build_trace_chunk_id
)
::
Ci
::
BuildTraceChunk
.
find_by
(
id:
build_trace_chunk_id
).
try
do
|
build_trace_chunk
|
build_trace_chunk
.
persist!
build_trace_chunk
.
persist
_data
!
end
end
end
...
...
spec/models/ci/build_trace_chunk_spec.rb
View file @
49467379
...
...
@@ -286,8 +286,8 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
end
end
describe
'#persist!'
do
subject
{
build_trace_chunk
.
persist!
}
describe
'#persist
_data
!'
do
subject
{
build_trace_chunk
.
persist
_data
!
}
context
'when data_store is redis'
do
let
(
:data_store
)
{
:redis
}
...
...
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