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
Boxiang Sun
gitlab-ce
Commits
a2d79e1f
Commit
a2d79e1f
authored
Feb 06, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorder async/sync tasks in BuildFinishedWorker to read traces efficiently
parent
d30e71b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
app/workers/build_finished_worker.rb
app/workers/build_finished_worker.rb
+5
-2
spec/workers/build_finished_worker_spec.rb
spec/workers/build_finished_worker_spec.rb
+6
-10
No files found.
app/workers/build_finished_worker.rb
View file @
a2d79e1f
...
@@ -6,8 +6,11 @@ class BuildFinishedWorker
...
@@ -6,8 +6,11 @@ class BuildFinishedWorker
def
perform
(
build_id
)
def
perform
(
build_id
)
Ci
::
Build
.
find_by
(
id:
build_id
).
try
do
|
build
|
Ci
::
Build
.
find_by
(
id:
build_id
).
try
do
|
build
|
BuildTraceSectionsWorker
.
perform_async
(
build
.
id
)
# We execute that in sync as this access the files in order to access local file, and reduce IO
BuildCoverageWorker
.
perform_async
(
build
.
id
)
BuildTraceSectionsWorker
.
new
.
perform
(
build
.
id
)
BuildCoverageWorker
.
new
.
perform
(
build
.
id
)
# We execute that async as this are two indepentent operations that can be executed after TraceSections and Coverage
BuildHooksWorker
.
perform_async
(
build
.
id
)
BuildHooksWorker
.
perform_async
(
build
.
id
)
CreateTraceArtifactWorker
.
perform_async
(
build
.
id
)
CreateTraceArtifactWorker
.
perform_async
(
build
.
id
)
end
end
...
...
spec/workers/build_finished_worker_spec.rb
View file @
a2d79e1f
...
@@ -6,19 +6,15 @@ describe BuildFinishedWorker do
...
@@ -6,19 +6,15 @@ describe BuildFinishedWorker do
let!
(
:build
)
{
create
(
:ci_build
)
}
let!
(
:build
)
{
create
(
:ci_build
)
}
it
'calculates coverage and calls hooks'
do
it
'calculates coverage and calls hooks'
do
expect
(
Build
Coverage
Worker
)
expect
(
Build
TraceSections
Worker
)
.
to
receive
(
:new
).
ordered
.
and_call_original
.
to
receive
(
:new
).
ordered
.
and_call_original
expect
(
Build
Hooks
Worker
)
expect
(
Build
Coverage
Worker
)
.
to
receive
(
:new
).
ordered
.
and_call_original
.
to
receive
(
:new
).
ordered
.
and_call_original
expect
(
BuildTraceSectionsWorker
)
expect_any_instance_of
(
BuildTraceSectionsWorker
).
to
receive
(
:perform
)
.
to
receive
(
:perform_async
)
expect_any_instance_of
(
BuildCoverageWorker
).
to
receive
(
:perform
)
expect
(
CreateTraceArtifactWorker
)
expect
(
BuildHooksWorker
).
to
receive
(
:perform_async
)
.
to
receive
(
:perform_async
)
expect
(
CreateTraceArtifactWorker
).
to
receive
(
:perform_async
)
expect_any_instance_of
(
BuildCoverageWorker
)
.
to
receive
(
:perform
)
expect_any_instance_of
(
BuildHooksWorker
)
.
to
receive
(
:perform
)
described_class
.
new
.
perform
(
build
.
id
)
described_class
.
new
.
perform
(
build
.
id
)
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