lib/graphql/execution/multiplex.rb in graphql-1.6.4 vs lib/graphql/execution/multiplex.rb in graphql-1.6.5

- old
+ new

@@ -33,21 +33,22 @@ @queries = queries @context = context end class << self - def run_all(schema, query_options, *rest) + def run_all(schema, query_options, *args) queries = query_options.map { |opts| GraphQL::Query.new(schema, nil, opts) } - run_queries(schema, queries, *rest) + run_queries(schema, queries, *args) end # @param schema [GraphQL::Schema] # @param queries [Array<GraphQL::Query>] # @param context [Hash] - # @param max_complexity [Integer] + # @param max_complexity [Integer, nil] # @return [Array<Hash>] One result per query - def run_queries(schema, queries, context: {}, max_complexity: nil) + def run_queries(schema, queries, context: {}, max_complexity: schema.max_complexity) + if has_custom_strategy?(schema) if queries.length != 1 raise ArgumentError, "Multiplexing doesn't support custom execution strategies, run one query at a time instead" else with_instrumentation(schema, queries, context: context, max_complexity: max_complexity) do @@ -159,10 +160,10 @@ queries.each do |query| query_instrumenters.each { |i| i.before_query(query) } end multiplex_analyzers = schema.multiplex_analyzers - if max_complexity ||= schema.max_complexity + if max_complexity multiplex_analyzers += [GraphQL::Analysis::MaxQueryComplexity.new(max_complexity)] end GraphQL::Analysis.analyze_multiplex(multiplex, multiplex_analyzers)