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
497b5569
Commit
497b5569
authored
Mar 20, 2020
by
Jan Provaznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove graphql_resolver_complexity flag
Resolver complexity was enabled on gitlab.com and behaved stable.
parent
ac4c5ded
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
30 deletions
+5
-30
app/graphql/types/base_field.rb
app/graphql/types/base_field.rb
+0
-6
changelogs/unreleased/graphql-complexity-flag.yml
changelogs/unreleased/graphql-complexity-flag.yml
+5
-0
spec/graphql/types/base_field_spec.rb
spec/graphql/types/base_field_spec.rb
+0
-11
spec/requests/api/graphql_spec.rb
spec/requests/api/graphql_spec.rb
+0
-13
No files found.
app/graphql/types/base_field.rb
View file @
497b5569
...
...
@@ -90,8 +90,6 @@ module Types
# proc because we set complexity depending on arguments and number of
# items which can be loaded.
proc
do
|
ctx
,
args
,
child_complexity
|
next
base_complexity
unless
resolver_complexity_enabled?
(
ctx
)
# Resolvers may add extra complexity depending on used arguments
complexity
=
child_complexity
+
self
.
resolver
&
.
try
(
:resolver_complexity
,
args
,
child_complexity:
child_complexity
).
to_i
complexity
+=
1
if
calls_gitaly?
...
...
@@ -101,10 +99,6 @@ module Types
end
end
def
resolver_complexity_enabled?
(
ctx
)
ctx
.
fetch
(
:graphql_resolver_complexity_flag
)
{
|
key
|
ctx
[
key
]
=
Feature
.
enabled?
(
:graphql_resolver_complexity
)
}
end
def
connection_complexity_multiplier
(
ctx
,
args
)
# Resolvers may add extra complexity depending on number of items being loaded.
field_defn
=
to_graphql
...
...
changelogs/unreleased/graphql-complexity-flag.yml
0 → 100644
View file @
497b5569
---
title
:
Fix processing of GrapqhQL query complexity based on used resolvers.
merge_request
:
27652
author
:
type
:
fixed
spec/graphql/types/base_field_spec.rb
View file @
497b5569
...
...
@@ -67,17 +67,6 @@ describe Types::BaseField do
expect
(
field
.
to_graphql
.
complexity
.
call
({},
{
first:
1
},
2
)).
to
eq
2
expect
(
field
.
to_graphql
.
complexity
.
call
({},
{
first:
1
,
foo:
true
},
2
)).
to
eq
4
end
context
'when graphql_resolver_complexity is disabled'
do
before
do
stub_feature_flags
(
graphql_resolver_complexity:
false
)
end
it
'sets default field complexity'
do
expect
(
field
.
to_graphql
.
complexity
.
call
({},
{},
2
)).
to
eq
1
expect
(
field
.
to_graphql
.
complexity
.
call
({},
{
first:
50
},
2
)).
to
eq
1
end
end
end
context
'and is not a connection'
do
...
...
spec/requests/api/graphql_spec.rb
View file @
497b5569
...
...
@@ -165,7 +165,6 @@ describe 'GraphQL' do
before
do
stub_const
(
'GitlabSchema::DEFAULT_MAX_COMPLEXITY'
,
6
)
stub_feature_flags
(
graphql_resolver_complexity:
true
)
end
context
'when fetching single resource'
do
...
...
@@ -186,18 +185,6 @@ describe 'GraphQL' do
expect_graphql_errors_to_include
(
/which exceeds max complexity/
)
end
context
'when graphql_resolver_complexity is disabled'
do
before
do
stub_feature_flags
(
graphql_resolver_complexity:
false
)
end
it
'processes the query'
do
post_graphql
(
query
)
expect
(
graphql_errors
).
to
be_nil
end
end
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