@@ -16,7 +16,6 @@ use graph::prelude::{
1616} ;
1717
1818use crate :: execution:: ast as a;
19- use crate :: introspection:: introspection_schema;
2019use crate :: query:: { ast as qast, ext:: BlockConstraint } ;
2120use crate :: schema:: ast as sast;
2221use crate :: {
@@ -98,7 +97,6 @@ pub struct Query {
9897 pub query_text : Arc < String > ,
9998 pub variables_text : Arc < String > ,
10099 pub query_id : String ,
101- pub ( crate ) complexity : u64 ,
102100}
103101
104102impl Query {
@@ -168,9 +166,11 @@ impl Query {
168166 fragments,
169167 } ;
170168
171- // It's important to check complexity first, so `validate_fields` doesn't risk a stack
172- // overflow from invalid queries.
173- let complexity = raw_query. check_complexity ( max_complexity, max_depth) ?;
169+ // It's important to check complexity first, so `validate_fields`
170+ // doesn't risk a stack overflow from invalid queries. We don't
171+ // really care about the resulting complexity, only that all the
172+ // checks that `check_complexity` performs pass successfully
173+ let _ = raw_query. check_complexity ( max_complexity, max_depth) ?;
174174 raw_query. validate_fields ( ) ?;
175175 let ( selection_set, fragments) = raw_query. expand_variables ( ) ?;
176176
@@ -186,7 +186,6 @@ impl Query {
186186 query_text : query. query_text . cheap_clone ( ) ,
187187 variables_text : query. variables_text . cheap_clone ( ) ,
188188 query_id,
189- complexity,
190189 } ;
191190
192191 Ok ( Arc :: new ( query) )
@@ -259,26 +258,6 @@ impl Query {
259258 }
260259 }
261260
262- /// Return this query, but use the introspection schema as its schema
263- pub fn as_introspection_query ( & self ) -> Arc < Self > {
264- let introspection_schema = introspection_schema ( self . schema . id ( ) . clone ( ) ) ;
265-
266- Arc :: new ( Self {
267- schema : Arc :: new ( introspection_schema) ,
268- fragments : self . fragments . clone ( ) ,
269- selection_set : self . selection_set . clone ( ) ,
270- shape_hash : self . shape_hash ,
271- kind : self . kind ,
272- network : self . network . clone ( ) ,
273- logger : self . logger . clone ( ) ,
274- start : self . start ,
275- query_text : self . query_text . clone ( ) ,
276- variables_text : self . variables_text . clone ( ) ,
277- query_id : self . query_id . clone ( ) ,
278- complexity : self . complexity ,
279- } )
280- }
281-
282261 /// Should only be called for fragments that exist in the query, and therefore have been
283262 /// validated to exist. Panics otherwise.
284263 pub fn get_fragment ( & self , name : & str ) -> & a:: FragmentDefinition {
0 commit comments