Sha256: 86bb7576fc205dc0540887c350b921294bbfbb0b56ff2a09f70fcf8156ff3879

Contents?: true

Size: 663 Bytes

Versions: 2

Compression:

Stored size: 663 Bytes

Contents

def create_slow_field
  GraphQL::Field.define do
    type(types.Int)
    resolve -> (obj, args, ctx) {
      ctx.async {
        sleep 0.3
        1
      }
    }
  end
end

SlowType = GraphQL::ObjectType.define do
  name "Slow"
  field :slow1, field: create_slow_field
  field :slow2, field: create_slow_field
  field :slow3, field: create_slow_field
  field :slows, -> { types[SlowType] } do
    resolve -> (o, a, ctx)  { ctx.async { [:slow, :slow, :slow] } }
  end
end

SlowQueryType = GraphQL::ObjectType.define do
  name "Query"
  field :slow, SlowType do
    resolve -> (o, a, c) { :slow }
  end
end

SlowSchema = GraphQL::Schema.new(query: SlowQueryType)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphql-0.8.1 spec/support/parallel_schema.rb
graphql-0.8.0 spec/support/parallel_schema.rb