Class: Gitlab::Graphql::CallsGitaly::FieldExtension

Inherits:
GraphQL::Schema::FieldExtension
  • Object
show all
Includes:
Laziness
Defined in:
lib/gitlab/graphql/calls_gitaly/field_extension.rb

Overview

Check if any ‘calls_gitaly: true` declarations need to be added

See BaseField: this extension is not applied if the field does not need it (i.e. it has a constant complexity or knows that it calls gitaly)

Instance Method Summary collapse

Methods included from Laziness

#defer, #force

Instance Method Details

#after_resolve(value:, memo:, **rest) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/gitlab/graphql/calls_gitaly/field_extension.rb', line 18

def after_resolve(value:, memo:, **rest)
  (value, count) = value_with_count(value, memo)
  calls_gitaly_check(count)
  accounted_for(count)

  value
end

#resolve(object:, arguments:, **rest) {|object, arguments, [current_gitaly_call_count, accounted_for]| ... } ⇒ Object

Yields:

  • (object, arguments, [current_gitaly_call_count, accounted_for])


14
15
16
# File 'lib/gitlab/graphql/calls_gitaly/field_extension.rb', line 14

def resolve(object:, arguments:, **rest)
  yield(object, arguments, [current_gitaly_call_count, accounted_for])
end