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
812dd06d
Commit
812dd06d
authored
May 04, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce Redis helpers. Rename BuildTraceChunkFlushToDbWorker to Ci::BuildTraceChunkFlushWorker.
parent
47c8e06c
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
51 additions
and
30 deletions
+51
-30
app/models/ci/build_trace_chunk.rb
app/models/ci/build_trace_chunk.rb
+1
-1
app/workers/all_queues.yml
app/workers/all_queues.yml
+1
-1
app/workers/build_trace_chunk_flush_to_db_worker.rb
app/workers/build_trace_chunk_flush_to_db_worker.rb
+0
-12
app/workers/ci/build_trace_chunk_flush_worker.rb
app/workers/ci/build_trace_chunk_flush_worker.rb
+13
-0
spec/models/ci/build_trace_chunk_spec.rb
spec/models/ci/build_trace_chunk_spec.rb
+2
-2
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+3
-3
spec/spec_helper.rb
spec/spec_helper.rb
+13
-6
spec/support/chunked_io/chunked_io_helpers.rb
spec/support/chunked_io/chunked_io_helpers.rb
+0
-5
spec/support/redis/redis_helpers.rb
spec/support/redis/redis_helpers.rb
+18
-0
No files found.
app/models/ci/build_trace_chunk.rb
View file @
812dd06d
...
...
@@ -99,7 +99,7 @@ module Ci
def
schedule_to_db
return
if
db?
BuildTraceChunkFlushToDb
Worker
.
perform_async
(
id
)
Ci
::
BuildTraceChunkFlush
Worker
.
perform_async
(
id
)
end
def
fullfilled?
...
...
app/workers/all_queues.yml
View file @
812dd06d
...
...
@@ -66,7 +66,7 @@
-
pipeline_processing:pipeline_update
-
pipeline_processing:stage_update
-
pipeline_processing:update_head_pipeline_for_merge_request
-
pipeline_processing:
build_trace_chunk_flush_to_db
-
pipeline_processing:
ci_build_trace_chunk_flush
-
repository_check:repository_check_clear
-
repository_check:repository_check_single_repository
...
...
app/workers/build_trace_chunk_flush_to_db_worker.rb
deleted
100644 → 0
View file @
47c8e06c
class
BuildTraceChunkFlushToDbWorker
include
ApplicationWorker
include
PipelineQueue
queue_namespace
:pipeline_processing
def
perform
(
build_trace_chunk_id
)
Ci
::
BuildTraceChunk
.
find_by
(
id:
build_trace_chunk_id
).
try
do
|
build_trace_chunk
|
build_trace_chunk
.
use_database!
end
end
end
app/workers/ci/build_trace_chunk_flush_worker.rb
0 → 100644
View file @
812dd06d
module
Ci
class
BuildTraceChunkFlushWorker
include
ApplicationWorker
queue_namespace
:pipeline_processing
def
perform
(
build_trace_chunk_id
)
::
Ci
::
BuildTraceChunk
.
find_by
(
id:
build_trace_chunk_id
).
try
do
|
build_trace_chunk
|
build_trace_chunk
.
use_database!
end
end
end
end
spec/models/ci/build_trace_chunk_spec.rb
View file @
812dd06d
...
...
@@ -75,7 +75,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
let
(
:value
)
{
'a'
*
described_class
::
CHUNK_SIZE
}
it
'schedules stashing data'
do
expect
(
BuildTraceChunkFlushToDb
Worker
).
to
receive
(
:perform_async
).
once
expect
(
Ci
::
BuildTraceChunkFlush
Worker
).
to
receive
(
:perform_async
).
once
subject
end
...
...
@@ -112,7 +112,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
context
'when fullfilled chunk size'
do
it
'does not schedule stashing data'
do
expect
(
BuildTraceChunkFlushToDb
Worker
).
not_to
receive
(
:perform_async
)
expect
(
Ci
::
BuildTraceChunkFlush
Worker
).
not_to
receive
(
:perform_async
)
subject
end
...
...
spec/requests/api/runner_spec.rb
View file @
812dd06d
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
API
::
Runner
,
:clean_gitlab_redis_shared_state
do
include
StubGitlabCalls
include
ChunkedIO
Helpers
include
Redis
Helpers
let
(
:registration_token
)
{
'abcdefg123456'
}
...
...
@@ -873,8 +873,8 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
patch_the_trace
expect
(
job
.
reload
.
trace
.
raw
).
to
eq
'BUILD TRACE appended appended'
# GitLab-Rails en
x
ounters an outage on Redis
redis_shared_state_
outage
!
# GitLab-Rails en
c
ounters an outage on Redis
redis_shared_state_
cleanup
!
expect
(
job
.
reload
.
trace
.
raw
).
to
eq
''
# GitLab-Runner patchs
...
...
spec/spec_helper.rb
View file @
812dd06d
...
...
@@ -86,6 +86,7 @@ RSpec.configure do |config|
config
.
include
WaitForRequests
,
:js
config
.
include
LiveDebugger
,
:js
config
.
include
MigrationsHelpers
,
:migration
config
.
include
RedisHelpers
if
ENV
[
'CI'
]
# This includes the first try, i.e. tests will be run 4 times before failing.
...
...
@@ -146,21 +147,27 @@ RSpec.configure do |config|
end
config
.
around
(
:each
,
:clean_gitlab_redis_cache
)
do
|
example
|
Gitlab
::
Redis
::
Cache
.
with
(
&
:flushall
)
redis_cache_cleanup!
example
.
run
Gitlab
::
Redis
::
Cache
.
with
(
&
:flushall
)
redis_cache_cleanup!
end
config
.
around
(
:each
,
:clean_gitlab_redis_shared_state
)
do
|
example
|
Gitlab
::
Redis
::
SharedState
.
with
(
&
:flushall
)
Sidekiq
.
redis
(
&
:flushall
)
redis_shared_state_cleanup!
example
.
run
Gitlab
::
Redis
::
SharedState
.
with
(
&
:flushall
)
Sidekiq
.
redis
(
&
:flushall
)
redis_shared_state_cleanup!
end
config
.
around
(
:each
,
:clean_gitlab_redis_queues
)
do
|
example
|
redis_queues_cleanup!
example
.
run
redis_queues_cleanup!
end
# The :each scope runs "inside" the example, so this hook ensures the DB is in the
...
...
spec/support/chunked_io/chunked_io_helpers.rb
View file @
812dd06d
...
...
@@ -8,9 +8,4 @@ module ChunkedIOHelpers
stub_const
(
'Ci::BuildTraceChunk::CHUNK_SIZE'
,
size
)
stub_const
(
'Gitlab::Ci::Trace::ChunkedIO::CHUNK_SIZE'
,
size
)
end
def
redis_shared_state_outage!
Gitlab
::
Redis
::
SharedState
.
with
(
&
:flushall
)
Sidekiq
.
redis
(
&
:flushall
)
end
end
spec/support/redis/redis_helpers.rb
0 → 100644
View file @
812dd06d
module
RedisHelpers
# config/README.md
# Usage: performance enhancement
def
redis_cache_cleanup!
Gitlab
::
Redis
::
Cache
.
with
(
&
:flushall
)
end
# Usage: SideKiq, Mailroom, CI Runner, Workhorse, push services
def
redis_queues_cleanup!
Gitlab
::
Redis
::
Queues
.
with
(
&
:flushall
)
end
# Usage: session state, rate limiting
def
redis_shared_state_cleanup!
Gitlab
::
Redis
::
SharedState
.
with
(
&
:flushall
)
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