Datafetchers as completable futures don't run in parallel #509
Replies: 3 comments 3 replies
-
You’ll need to provide an Executor as the second argument when creating the
CompletableFuture
…On Mon, Aug 2, 2021 at 5:36 PM David Graham ***@***.***> wrote:
I created two simple datafetchers as completable futures but they don't
run in parallel. What am I missing here?
Simple schema:
[image: image]
<https://user-images.githubusercontent.com/4474660/127939638-1896f998-eaa0-4cc6-a4de-51e583594931.png>
Users DataFetcher:
[image: image]
<https://user-images.githubusercontent.com/4474660/127939698-3c53cdf8-ead1-41a9-ba99-308c9887f93e.png>
Products DataFetcher:
[image: image]
<https://user-images.githubusercontent.com/4474660/127939731-8c509bbc-86f0-42ef-a214-1c1862bc4fa6.png>
They don't run in parallel:
[image: image]
<https://user-images.githubusercontent.com/4474660/127939755-dcd7e14f-3d76-486e-ad54-f77eaf4c51f9.png>
I could create the futures and join them within a single datafetcher but
that defeats the nice annotation ability of DGS right? It is because one is
Query and the other is an Object Type (on different levels, so-to-speak)?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#509>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA2XLAHI57VFYMXDTGT3W3T242XVANCNFSM5BNYDSSA>
.
|
Beta Was this translation helpful? Give feedback.
-
Any example of how to use an executor @paulbakker to get datafetchers to actually work in parallel? |
Beta Was this translation helpful? Give feedback.
-
This was answered in #512:
|
Beta Was this translation helpful? Give feedback.
-
I created two simple datafetchers as completable futures but they don't run in parallel. What am I missing here?
Simple schema:
Users DataFetcher:
Products DataFetcher:
They don't run in parallel:
I could create the futures and join them within a single datafetcher but that defeats the nice annotation ability of DGS right? It is because one is Query and the other is an Object Type (on different levels, so-to-speak)?
Beta Was this translation helpful? Give feedback.
All reactions