Skip to content

feat: update graphql-java dataloader version #1450

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

Conversation

samuelAndalon
Copy link
Contributor

@samuelAndalon samuelAndalon commented May 31, 2022

📝 Description

In order to have a better mechanism to dispatch a data loader registry we needed to have access to all CompletableFutures by DataLoader, initially we did it by creating a custom implementation of the CacheMap interface, but we added support to do it directly from the data loader library

graphql-java/java-dataloader#115

PR was released on version 3.1.3

probably in the future we can even add the custom methods

  1. getOnDispatchFutures
  2. getCurrentFutures
  3. dispatchAll (overrided)
  4. onDispatchFuturesHandled
  5. dataLoadersInvokedOnDispatch

to DataLoaderRegistry that we added in KotlinDataLoaderRegistry, that way we can stop decorating the registry and use the one provided by graphql-java-dataloader

import java.util.Optional
import java.util.concurrent.CompletableFuture

data class MissionServiceRequest(val id: Int, val astronautId: Int = -1)

class MissionDataLoader : KotlinDataLoader<MissionServiceRequest, Mission?> {
override val dataLoaderName: String = "MissionDataLoader"
override fun getOptions(): DataLoaderOptions = DataLoaderOptions.newOptions().setStatisticsCollector { SimpleStatisticsCollector() }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for testing purposes we need statistics but in this new release, those are now NOOP by default

@tapaderster
Copy link
Member

lgtm

@samuelAndalon samuelAndalon merged commit de48b02 into ExpediaGroup:master Jun 2, 2022
@samuelAndalon samuelAndalon deleted the feat/update-data-loader-version branch June 2, 2022 16:31
@dariuszkuc dariuszkuc added the changes: patch Changes require a patch version label Jun 20, 2022
dariuszkuc pushed a commit to dariuszkuc/graphql-kotlin that referenced this pull request Aug 5, 2022
* feat: update graphql-java dataloader with version that provides access to cacheMap

* feat: update coverage

* feat: update docs

* feat: update test

Co-authored-by: samvazquez <samvazquez@expedia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes: patch Changes require a patch version
Development

Successfully merging this pull request may close these issues.

3 participants