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

Implement dataloader #37

Merged
merged 9 commits into from
May 21, 2020
Merged

Implement dataloader #37

merged 9 commits into from
May 21, 2020

Conversation

preetjdp
Copy link
Owner

What Does this PR do?.

Adds Dataloader to the server to batch and cache User queries.

Describe In brief the solution / approach you've gone with.

The approach used here uses Dataloader of which a new instance is created on every new connection.

The Dataloader is then made available using dependency injection mentioned here.
MichalLytek/type-graphql#51 (comment)

Describe alternatives you may have considered

  • A alternate would have been to add Dataloader to the appContext, but the problem with that is would have been difficult to manage and expand overtime.

  • Use the dataloader over larger time, use it more as a cache with a different lifecycle than that of the request.
    Pros of this approach.
    This would mean significantly lesser hits to the database and that's amazing.

** Cons of this approach**
Would be difficult to maintain the lifecycle of the Dataloader and may lead to significant memory leaks and hell.

Additional context / quirks

Add any other context, screenshots, or quirks about the implmentation here.

@preetjdp preetjdp merged commit 4b74e1f into master May 21, 2020
@preetjdp preetjdp deleted the Implement-Dataloader branch May 21, 2020 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant