BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
b828a98c
Unverified
Commit
b828a98c
authored
Apr 06, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimise includes
parent
8a1c12aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
pipeline_serializer.rb
app/serializers/pipeline_serializer.rb
+9
-1
pipeline_serializer_spec.rb
spec/serializers/pipeline_serializer_spec.rb
+2
-1
No files found.
app/serializers/pipeline_serializer.rb
View file @
b828a98c
...
...
@@ -13,7 +13,15 @@ class PipelineSerializer < BaseSerializer
def
represent
(
resource
,
opts
=
{})
if
resource
.
is_a?
(
ActiveRecord
::
Relation
)
resource
=
resource
.
includes
(
project: :namespace
)
resource
=
resource
.
includes
(
:project
)
resource
=
resource
.
includes
(
:pending_builds
,
:retryable_builds
,
:cancelable_statuses
,
:manual_actions
,
:artifacts
)
resource
=
resource
.
includes
(
pending_builds: :project
)
resource
=
resource
.
includes
(
manual_actions: :project
)
resource
=
resource
.
includes
(
artifacts: :project
)
end
if
paginated?
...
...
spec/serializers/pipeline_serializer_spec.rb
View file @
b828a98c
...
...
@@ -105,7 +105,8 @@ describe PipelineSerializer do
it
"verifies number of queries"
do
recorded
=
ActiveRecord
::
QueryRecorder
.
new
{
subject
}
expect
(
recorded
.
count
).
to
be_within
(
200
).
of
(
10
)
expect
(
recorded
.
count
).
to
be_within
(
10
).
of
(
230
)
expect
(
recorded
.
cached_count
).
to
be_within
(
5
).
of
(
5
)
end
def
create_pipeline
(
status
)
...
...
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