Add spec for better loads: dataloading, prototype new loads code #5498
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implementing
loads:has had a smell in it:graphql-ruby/lib/graphql/schema/argument.rb
Line 338 in c4f07cd
graphql-ruby/lib/graphql/schema/argument.rb
Line 359 in c4f07cd
It's there because some code requires the argument values to be returned right away -- it doesn't use Dataloader (properly?).
This smell manifests the problem described in #5462 -- I added a spec for that issue in cf3a3f8
This problem also surfaced in #5479 because, when using
Async,run_isolatedisn't actually isolated: Async uses a top-level pool, so a pause in one place in the code can resume code elsewhere.The smell was also called out in #5389 (comment).
When working on #5389, I didn't actually rework this code. But I think it's actually a good place to try out that new flow in an incremental way.
Fixes #5462
TODO:
run_isolatedcallrun_isolatedcall?while ...; dataloader.yield; end-- some proper way for expressing or communicating dependencies in the codeafter_lazyusage in loading and authorization