Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array elements are being resolved in series instead of parallel? #592

Closed
AttilaTheFun opened this issue Jan 13, 2021 · 2 comments
Closed

Comments

@AttilaTheFun
Copy link

I've been using this library for a while, but I just got around to setting up open tracing for it.
While looking at some of the traces, I noticed what appears to be serial resolution of fields on array elements.

This is a screenshot from a trace where I fetched my inbox which had 12 threads. As you can see, the display data field appears to be resolved in series for threads 0...11.

Screen Shot 2021-01-12 at 10 37 08 PM

What I would expect is that these resolvers would run in parallel, and would only block if they hit a dataloader. From this PR I assumed that resolution was supposed to be async-by-default. #388

Is this by design? Or am I holding it wrong? I'm happy to provide more information but I'm not sure what would be helpful.

@AttilaTheFun
Copy link
Author

Ah I think I might know what's wrong - I just looked at the concurrent resolvers example and saw that the resolvers there return thunks. I think I need to update my resolvers to return functions if I want them to be async. I thought all of the resolvers were executed concurrently (at the same field level) by default. I'll try that and close this issue if it is resolved.

@AttilaTheFun
Copy link
Author

Yeah that was the issue - I had to return a thunk in order to get that to work asynchronously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant