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
daef07bd
Commit
daef07bd
authored
Sep 13, 2021
by
David Fernandez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid a duplicated SQL condition in the NPM metadata endpoint
Changelog: performance
parent
bd2057d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
35 deletions
+15
-35
config/feature_flags/development/npm_finder_query_avoid_duplicated_conditions.yml
...elopment/npm_finder_query_avoid_duplicated_conditions.yml
+0
-8
lib/api/helpers/packages/npm.rb
lib/api/helpers/packages/npm.rb
+1
-1
spec/requests/api/npm_instance_packages_spec.rb
spec/requests/api/npm_instance_packages_spec.rb
+14
-26
No files found.
config/feature_flags/development/npm_finder_query_avoid_duplicated_conditions.yml
deleted
100644 → 0
View file @
bd2057d4
---
name
:
npm_finder_query_avoid_duplicated_conditions
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69572
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/340099
milestone
:
'
14.3'
type
:
development
group
:
group::package
default_enabled
:
false
lib/api/helpers/packages/npm.rb
View file @
daef07bd
...
...
@@ -60,7 +60,7 @@ module API
finder
=
::
Packages
::
Npm
::
PackageFinder
.
new
(
package_name
,
namespace:
namespace
,
last_of_each_version:
Feature
.
disabled?
(
:npm_finder_query_avoid_duplicated_conditions
)
last_of_each_version:
false
)
finder
.
last
&
.
project_id
...
...
spec/requests/api/npm_instance_packages_spec.rb
View file @
daef07bd
...
...
@@ -10,39 +10,27 @@ RSpec.describe API::NpmInstancePackages do
include_context
'npm api setup'
shared_examples
'handling all endpoints'
do
describe
'GET /api/v4/packages/npm/*package_name'
do
it_behaves_like
'handling get metadata requests'
,
scope: :instance
do
let
(
:url
)
{
api
(
"/packages/npm/
#{
package_name
}
"
)
}
end
end
describe
'GET /api/v4/packages/npm/-/package/*package_name/dist-tags'
do
it_behaves_like
'handling get dist tags requests'
,
scope: :instance
do
let
(
:url
)
{
api
(
"/packages/npm/-/package/
#{
package_name
}
/dist-tags"
)
}
end
describe
'GET /api/v4/packages/npm/*package_name'
do
it_behaves_like
'handling get metadata requests'
,
scope: :instance
do
let
(
:url
)
{
api
(
"/packages/npm/
#{
package_name
}
"
)
}
end
end
describe
'PUT /api/v4/packages/npm/-/package/*package_name/dist-tags/:tag'
do
it_behaves_like
'handling create dist tag requests'
,
scope: :instance
do
let
(
:url
)
{
api
(
"/packages/npm/-/package/
#{
package_name
}
/dist-tags/
#{
tag_name
}
"
)
}
end
describe
'GET /api/v4/packages/npm/-/package/*package_name/dist-tags'
do
it_behaves_like
'handling get dist tags requests'
,
scope: :instance
do
let
(
:url
)
{
api
(
"/packages/npm/-/package/
#{
package_name
}
/dist-tags"
)
}
end
end
describe
'DELETE /api/v4/packages/npm/-/package/*package_name/dist-tags/:tag'
do
it_behaves_like
'handling delete dist tag requests'
,
scope: :instance
do
let
(
:url
)
{
api
(
"/packages/npm/-/package/
#{
package_name
}
/dist-tags/
#{
tag_name
}
"
)
}
end
describe
'PUT /api/v4/packages/npm/-/package/*package_name/dist-tags/:tag'
do
it_behaves_like
'handling create dist tag requests'
,
scope: :instance
do
let
(
:url
)
{
api
(
"/packages/npm/-/package/
#{
package_name
}
/dist-tags/
#{
tag_name
}
"
)
}
end
end
it_behaves_like
'handling all endpoints'
context
'with npm_finder_query_avoid_duplicated_conditions disabled'
do
before
do
stub_feature_flags
(
npm_finder_query_avoid_duplicated_conditions:
false
)
describe
'DELETE /api/v4/packages/npm/-/package/*package_name/dist-tags/:tag'
do
it_behaves_like
'handling delete dist tag requests'
,
scope: :instance
do
let
(
:url
)
{
api
(
"/packages/npm/-/package/
#{
package_name
}
/dist-tags/
#{
tag_name
}
"
)
}
end
it_behaves_like
'handling all endpoints'
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