Using dataloader at leaf level of multi layer schema failed to batch
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- graphql, javascript, postgres
Direzione di ricerca
Inizia riproducendo la query D→S→SW→W→C con un DataLoader solo al livello foglia C, usando la configurazione descritta di Apollo Server, Postgres e Knex. Confronta il batching con e senza batchScheduleFn, quindi aggiungi gli ancestor loader per W, SW e S; il lavoro è completato quando si è determinato se il comportamento è previsto o se si tratta di un bug di DataLoader, documentando la conclusione se appropriato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hi there,
I have a graphql schema like this:
D has many S has many SW has one W has many C.
D is available via a root level query.
(The underlying SQL has the same set of entities and relationships between them).
Using apollo server (not sure if relevant), postgres and knex.
I started by adding a dataloader for C. I then made a root level query for D, asking for all the properties of each element in the above schema. Testing revealed that the caching worked - each distinct C was only queried for once. But batching didn't work - for each distinct C, there was a separate SELECT.
When debugging this, added batchScheduleFn: (callback) => setTimeout(callback, 100) to the dataloader for C. At that point, batching started to work.
This made me think that somehow the C resolution was taking place on different event loop tics. On a hunch, I added a dataloader for W, SW and S. (none for D, as there is just one root level query for D).
After doing this, batching worked for all of S, SW, W and C - even with the batchSchedule function removed.
So I wanted to ask - is this possibly a bug (either in dataloader or, for a separate matter, Apollo Server), or is it expected that batching at the leaf node C would not work unless all ancestor nodes are also resolved with dataloaders?
If this isn't a bug, I wonder if adding this information to the documentation would be possible, to help other people who find themselves in this situation - implementing dataloader only at the leaf of a deep schema, and having batching not work they way they expected it would?
Anyhow, thanks for the library and its ongoing maintenance :)
- Lingua principale
- JavaScript
- Stelle
- 13.4k
- Fork
- 522
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di graphql/dataloader
-
[BUG] `maxBatchSize: NaN` is accepted and silently disables batchingForse già presa @RaphaelFakhri l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
graphql/dataloader#405 ·
-
Failed batch evicts a replacement cache entry after clear/primeForse già presa @Claire-ovo l’ha presa 11 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 57/100
graphql/dataloader#403 ·
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
graphql/dataloader#393 ·
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
graphql/dataloader#382 ·
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
graphql/dataloader#379 · 2 commenti · 5 reazioni ·
Tutte le issue di graphql/dataloader
Issue simili
-
binding:python bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
bug needs-triage potential-regression
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
aws/aws-sdk-js-v3#8408 ·
I maintainer di solito rispondono entro 1 giorno
-
[v3] KeyBindingManager calls (Add/Remove) are not converted into a case-insensitive accelerator.KeyApertaBug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100