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
Léo-Paul Géneau
gitlab-ce
Commits
45dc7ae2
Commit
45dc7ae2
authored
May 03, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up build_trace_chunk
parent
90da0d4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
app/models/ci/build_trace_chunk.rb
app/models/ci/build_trace_chunk.rb
+9
-8
app/models/concerns/fast_destroy_all.rb
app/models/concerns/fast_destroy_all.rb
+1
-1
No files found.
app/models/ci/build_trace_chunk.rb
View file @
45dc7ae2
...
...
@@ -80,8 +80,7 @@ module Ci
break
unless
size
>
0
self
.
update!
(
raw_data:
data
,
data_store: :db
)
key
=
self
.
class
.
redis_data_key
(
build_id
,
chunk_index
)
self
.
class
.
redis_delete_data
([
key
])
self
.
class
.
redis_delete_data
([
redis_data_key
])
end
end
...
...
@@ -129,22 +128,24 @@ module Ci
def
redis_data
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
redis
.
get
(
self
.
class
.
redis_data_key
(
build_id
,
chunk_index
)
)
redis
.
get
(
redis_data_key
)
end
end
def
redis_set_data
(
data
)
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
redis
.
set
(
self
.
class
.
redis_data_key
(
build_id
,
chunk_index
)
,
data
,
ex:
CHUNK_REDIS_TTL
)
redis
.
set
(
redis_data_key
,
data
,
ex:
CHUNK_REDIS_TTL
)
end
end
def
redis_
lock
_key
"trace_write:
#{
build_id
}
:chunks:
#{
chunk_index
}
"
def
redis_
data
_key
self
.
class
.
redis_data_key
(
build_id
,
chunk_index
)
end
def
in_lock
lease
=
Gitlab
::
ExclusiveLease
.
new
(
redis_lock_key
,
timeout:
WRITE_LOCK_TTL
)
write_lock_key
=
"trace_write:
#{
build_id
}
:chunks:
#{
chunk_index
}
"
lease
=
Gitlab
::
ExclusiveLease
.
new
(
write_lock_key
,
timeout:
WRITE_LOCK_TTL
)
retry_count
=
0
until
uuid
=
lease
.
try_obtain
...
...
@@ -159,7 +160,7 @@ module Ci
self
.
reload
if
self
.
persisted?
return
yield
ensure
Gitlab
::
ExclusiveLease
.
cancel
(
redis
_lock_key
,
uuid
)
Gitlab
::
ExclusiveLease
.
cancel
(
write
_lock_key
,
uuid
)
end
end
end
app/models/concerns/fast_destroy_all.rb
View file @
45dc7ae2
...
...
@@ -22,7 +22,7 @@ module FastDestroyAll
class_attribute
:_delete_method
,
:_delete_params_generator
before_destroy
do
raise
ForbiddenActionError
,
'`destroy`
is forbbiden, p
lease use `fast_destroy_all`'
raise
ForbiddenActionError
,
'`destroy`
and `destroy_all` are forbbiden. P
lease use `fast_destroy_all`'
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