@@ -18,7 +18,6 @@ use graph::data::schema::ApiSchema;
18
18
use graph:: prelude:: { info, o, q, r, s, BlockNumber , CheapClone , Logger , TryFromValue } ;
19
19
20
20
use crate :: execution:: ast as a;
21
- use crate :: introspection:: introspection_schema;
22
21
use crate :: query:: { ast as qast, ext:: BlockConstraint } ;
23
22
use crate :: schema:: ast as sast;
24
23
use crate :: {
@@ -135,7 +134,6 @@ pub struct Query {
135
134
pub query_text : Arc < String > ,
136
135
pub variables_text : Arc < String > ,
137
136
pub query_id : String ,
138
- pub ( crate ) complexity : u64 ,
139
137
}
140
138
141
139
impl Query {
@@ -220,9 +218,11 @@ impl Query {
220
218
fragments,
221
219
} ;
222
220
223
- // It's important to check complexity first, so `validate_fields` doesn't risk a stack
224
- // overflow from invalid queries.
225
- let complexity = raw_query. check_complexity ( max_complexity, max_depth) ?;
221
+ // It's important to check complexity first, so `validate_fields`
222
+ // doesn't risk a stack overflow from invalid queries. We don't
223
+ // really care about the resulting complexity, only that all the
224
+ // checks that `check_complexity` performs pass successfully
225
+ let _ = raw_query. check_complexity ( max_complexity, max_depth) ?;
226
226
raw_query. validate_fields ( ) ?;
227
227
let ( selection_set, fragments) = raw_query. expand_variables ( ) ?;
228
228
@@ -238,7 +238,6 @@ impl Query {
238
238
query_text : query. query_text . cheap_clone ( ) ,
239
239
variables_text : query. variables_text . cheap_clone ( ) ,
240
240
query_id,
241
- complexity,
242
241
} ;
243
242
244
243
Ok ( Arc :: new ( query) )
@@ -311,26 +310,6 @@ impl Query {
311
310
}
312
311
}
313
312
314
- /// Return this query, but use the introspection schema as its schema
315
- pub fn as_introspection_query ( & self ) -> Arc < Self > {
316
- let introspection_schema = introspection_schema ( self . schema . id ( ) . clone ( ) ) ;
317
-
318
- Arc :: new ( Self {
319
- schema : Arc :: new ( introspection_schema) ,
320
- fragments : self . fragments . clone ( ) ,
321
- selection_set : self . selection_set . clone ( ) ,
322
- shape_hash : self . shape_hash ,
323
- kind : self . kind ,
324
- network : self . network . clone ( ) ,
325
- logger : self . logger . clone ( ) ,
326
- start : self . start ,
327
- query_text : self . query_text . clone ( ) ,
328
- variables_text : self . variables_text . clone ( ) ,
329
- query_id : self . query_id . clone ( ) ,
330
- complexity : self . complexity ,
331
- } )
332
- }
333
-
334
313
/// Should only be called for fragments that exist in the query, and therefore have been
335
314
/// validated to exist. Panics otherwise.
336
315
pub fn get_fragment ( & self , name : & str ) -> & a:: FragmentDefinition {
0 commit comments