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
1f0de0b8
Commit
1f0de0b8
authored
Feb 22, 2022
by
Alishan Ladhani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix preloading of deployments
parent
073e579a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
app/serializers/environment_serializer.rb
app/serializers/environment_serializer.rb
+1
-1
spec/support/shared_examples/serializers/environment_serializer_shared_examples.rb
...les/serializers/environment_serializer_shared_examples.rb
+1
-1
No files found.
app/serializers/environment_serializer.rb
View file @
1f0de0b8
...
...
@@ -60,7 +60,7 @@ class EnvironmentSerializer < BaseSerializer
Preloaders
::
Environments
::
DeploymentPreloader
.
new
(
resource
)
.
execute_with_union
(
:upcoming_deployment
,
deployment_associations
)
resource
.
all
.
to_a
.
tap
do
|
environments
|
resource
.
to_a
.
tap
do
|
environments
|
environments
.
each
do
|
environment
|
# Batch loading the commits of the deployments
environment
.
last_deployment
&
.
commit
&
.
try
(
:lazy_author
)
...
...
spec/support/shared_examples/serializers/environment_serializer_shared_examples.rb
View file @
1f0de0b8
# frozen_string_literal: true
RSpec
.
shared_examples
'avoid N+1 on environments serialization'
do
|
ee:
false
|
# Investigating in https://gitlab.com/gitlab-org/gitlab/-/issues/353209
let
(
:query_threshold
)
{
50
+
(
ee
?
4
:
0
)
}
let
(
:query_threshold
)
{
9
+
(
ee
?
4
:
0
)
}
it
'avoids N+1 database queries with grouping'
,
:request_store
do
create_environment_with_associations
(
project
)
...
...
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