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
48f0eff3
Commit
48f0eff3
authored
Mar 18, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove N+1 queries in /admin/projects page
parent
ea5221ae
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
app/finders/admin/projects_finder.rb
app/finders/admin/projects_finder.rb
+1
-0
spec/controllers/admin/projects_controller_spec.rb
spec/controllers/admin/projects_controller_spec.rb
+10
-0
No files found.
app/finders/admin/projects_finder.rb
View file @
48f0eff3
...
...
@@ -16,6 +16,7 @@ class Admin::ProjectsFinder
items
=
by_archived
(
items
)
items
=
by_personal
(
items
)
items
=
by_name
(
items
)
items
=
items
.
includes
(
namespace:
[
:owner
])
sort
(
items
).
page
(
params
[
:page
])
end
...
...
spec/controllers/admin/projects_controller_spec.rb
View file @
48f0eff3
...
...
@@ -31,5 +31,15 @@ describe Admin::ProjectsController do
expect
(
response
.
body
).
not_to
match
(
pending_delete_project
.
name
)
expect
(
response
.
body
).
to
match
(
project
.
name
)
end
it
'does not have N+1 queries'
,
:use_clean_rails_memory_store_caching
,
:request_store
do
get
:index
control_count
=
ActiveRecord
::
QueryRecorder
.
new
{
get
:index
}.
count
create
(
:project
)
expect
{
get
:index
}.
not_to
exceed_query_limit
(
control_count
)
end
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