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
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
projects_finder.rb
app/finders/admin/projects_finder.rb
+1
-0
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