question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DataLoader batching doesn't work properly with lists

See original GitHub issue

Hello,

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:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
andimarekcommented, Jun 5, 2018

@arlampin yes, we actually managed to ship it in 9.0.

0reactions
andimarekcommented, Jun 5, 2018

closing it again, because it is fixed in 9.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does batching with a dataloader not work in a test?
I am using the dataloader library for node.js on a project where I create a graphQL API with Apollo Server. Code. function getClasses(args,...
Read more >
DataLoader not returning proper batch - PyTorch Forums
I input a list of three arrays of size 1024 to a custom Dataset , which will return element idx from each array...
Read more >
Common error messages in Data Loader - Salesforce Help
Cause 2: Batch size is set to higher number. Try reducing the batch size to 1 so that records are processed one by...
Read more >
Why does data loader fail a whole batch of records if just a ...
The problem is that the needed record sometimes doesn't exist, and with only one master that cannot be found, my whole batch of...
Read more >
Batching and Caching With Dataloader - Telerik
Dataloader is not something particular to Node.js and JavaScript ... It creates our loader by providing us a batch loading function.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found