-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataLoaderRegistry inefficiency #1902
Comments
This makes a lot of sense. DataLoaderRegistry is in the https://github.com/graphql-java/java-dataloader code base. I have raised this issue there as well |
I looked into this and it's really kinda pointless. We can make it lazy but as soon as you called We would have to write a fancy MemoizingSupplierWithTracking that could decide if its every been asked for and then filter them out from the list. In short I am not sure that its worth it. I would love to see more evidence now of the costs of creating a DL even if its not needed in a certain graphql request. |
I also found it is a problem in real world when the schema may contains thousand business objects and every |
Since DataLoaders are stateful, they themselves must be per request otherwise badness will happen. |
The
DataLoaderRegistry
should be request-scoped. That means that users are creating everyDataLoader
for every request even if none or only one or two are used.Right now we would do something like:
We could probably fix this by making
DataLoaderReigstry
a singleton and instead registering a function that would provide aDataLoader
:The text was updated successfully, but these errors were encountered: