Closed AttilaTheFun closed 3 years ago
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.
Yeah that was the issue - I had to return a thunk in order to get that to work asynchronously.
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.
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. https://github.com/graphql-go/graphql/pull/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.