DataLoader batching doesn't work properly with lists
See original GitHub issueHello,
There seems to be still some batching issues with DataLoader and DataLoaderDispatcherInstrumentation, even after #764 was merged.
I created a simple example in https://gist.github.com/arlampin/183d40ab7e8eb2507917fe8c46730189 that demonstrates the issue.
In the example, there is a simple tree of 7 items, like so:
1
/ \
2 3
/ \ / \
4 5 6 7
Using following query query Q { root { id childNodes { id childNodes { id childNodes { id }}}}}
(where ‘root’ is node 1) results in output:
BatchLoader called for [1] -> got [[2, 3]]
BatchLoader called for [2, 3] -> got [[4, 5], [6, 7]]
BatchLoader called for [4, 5] -> got [[], []]
BatchLoader called for [6, 7] -> got [[], []]
If I’ve understood correctly the idea behind DataLoader, there should only be three calls, one for each level in tree, and calls to [4, 5] and [6, 7] should have been merged into a single call.
This example doesn’t actually do any true async execution, but replacing CompletableFuture.completedFuture
with an async call doesn’t affect the results.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:10 (8 by maintainers)
@arlampin yes, we actually managed to ship it in 9.0.
closing it again, because it is fixed in 9.0.