★ wanayoo — archive 1999 https://github.com/graphql-java/graphql-java/issues/1902Nouvelle recherche | Portail wanayoo
Skip to content
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

Open
benmccann opened this issue May 19, 2020 · 1 comment
Open

DataLoaderRegistry inefficiency #1902

benmccann opened this issue May 19, 2020 · 1 comment
Milestone

Comments

@benmccann
Copy link
Contributor

@benmccann benmccann commented May 19, 2020

The DataLoaderRegistry should be request-scoped. That means that users are creating every DataLoader for every request even if none or only one or two are used.

Right now we would do something like:

    dataLoaderRegistry.register("user", DataLoader.newDataLoader(userBatchLoader));

We could probably fix this by making DataLoaderReigstry a singleton and instead registering a function that would provide a DataLoader:

    dataLoaderRegistry.register("user", () -> DataLoader.newDataLoader(userBatchLoaderProvider.get()));
@bbakerman
Copy link
Member

@bbakerman bbakerman commented May 23, 2020

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

graphql-java/java-dataloader#67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.