This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The general idea is that similarly to lazy evaluation, the interpreter executes each resolver from inside a Fiber. | |
# Once we have instantiated a Fiber for every resolver reachable in this pass, we loop over the Fibers, yielding till | |
# they are dead (the resolver has returned). Resolvers that are not using the Fiber based Loader API would simply | |
# return there value on the first pass. | |
# Complete pseudo-cpde, I don't know GraphQL Ruby internals well | |
def main_graphql_ruby_interpreter_loop(reachable_fields) | |
unresolved_fields = reachable_fields.reduce({}) do |acc, field| | |
# Creating one Fiber per field is probably too expensive, and we'd want to re-use them across loops or even across | |
# different fields in the same loop. A topic for another time. |