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
8242c100
Commit
8242c100
authored
Dec 23, 2019
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix gitlab_subscriptions N+1 query
parent
263ab502
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
0 deletions
+3
-0
ee/app/models/ee/namespace.rb
ee/app/models/ee/namespace.rb
+1
-0
lib/api/namespaces.rb
lib/api/namespaces.rb
+2
-0
No files found.
ee/app/models/ee/namespace.rb
View file @
8242c100
...
@@ -34,6 +34,7 @@ module EE
...
@@ -34,6 +34,7 @@ module EE
accepts_nested_attributes_for
:gitlab_subscription
accepts_nested_attributes_for
:gitlab_subscription
scope
:include_gitlab_subscription
,
->
{
includes
(
:gitlab_subscription
)
}
scope
:with_plan
,
->
{
where
.
not
(
plan_id:
nil
)
}
scope
:with_plan
,
->
{
where
.
not
(
plan_id:
nil
)
}
scope
:with_shared_runners_minutes_limit
,
->
{
where
(
"namespaces.shared_runners_minutes_limit > 0"
)
}
scope
:with_shared_runners_minutes_limit
,
->
{
where
(
"namespaces.shared_runners_minutes_limit > 0"
)
}
scope
:with_extra_shared_runners_minutes_limit
,
->
{
where
(
"namespaces.extra_shared_runners_minutes_limit > 0"
)
}
scope
:with_extra_shared_runners_minutes_limit
,
->
{
where
(
"namespaces.extra_shared_runners_minutes_limit > 0"
)
}
...
...
lib/api/namespaces.rb
View file @
8242c100
...
@@ -32,6 +32,8 @@ module API
...
@@ -32,6 +32,8 @@ module API
get
do
get
do
namespaces
=
current_user
.
admin
?
Namespace
.
all
:
current_user
.
namespaces
namespaces
=
current_user
.
admin
?
Namespace
.
all
:
current_user
.
namespaces
namespaces
=
namespaces
.
include_gitlab_subscription
if
Gitlab
.
ee?
namespaces
=
namespaces
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
namespaces
=
namespaces
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
options
=
{
with:
Entities
::
Namespace
,
current_user:
current_user
}
options
=
{
with:
Entities
::
Namespace
,
current_user:
current_user
}
...
...
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