Method: GraphQL::Dataloader#get_fiber_variables

Defined in:
lib/graphql/dataloader.rb

#get_fiber_variablesHash<Symbol, Object>

This is called before the fiber is spawned, from the parent context (i.e. from the thread or fiber that it is scheduled from).

Returns:

  • (Hash<Symbol, Object>)

    Current fiber-local variables



81
82
83
84
85
86
87
# File 'lib/graphql/dataloader.rb', line 81

def get_fiber_variables
  fiber_vars = {}
  Thread.current.keys.each do |fiber_var_key|
    fiber_vars[fiber_var_key] = Thread.current[fiber_var_key]
  end
  fiber_vars
end