You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You must opt-in to Chained DataLoaders via `GraphQLUnusualConfiguration.DataloaderConfig`, as this may change order of dispatching.
391
391
392
-
1. Set `enableDataLoaderChaining(true)` to enable Chained DataLoaders
393
-
2. Provide a `ScheduledExecutorService` to GraphQL Java, with method `delayedDataLoaderExecutorFactory` and a parameter that implements `DelayedDataLoaderDispatcherExecutorFactory`
392
+
Set `enableDataLoaderChaining(true)` to enable Chained DataLoaders.
394
393
395
394
For example, to set `enableDataLoaderChaining`:
396
395
```java
@@ -410,7 +409,7 @@ Note: The GraphQL Java engine can only optimally calculate DataLoader dispatches
410
409
411
410
### A special case: Delayed DataLoaders
412
411
413
-
In a previous code snippet we demonstrated one DataLoader depending on another DataLoader.
412
+
In a previous code snippet, we demonstrated one DataLoader depending on another DataLoader.
414
413
415
414
Another special case is a "delayed" DataLoader, where a DataLoader depends on a slow async task instead. For example, here are two DataFetchers from [a test example](https://github.com/graphql-java/graphql-java/blob/master/src/test/groovy/graphql/ChainedDataLoaderTest.groovy):
416
415
@@ -434,8 +433,4 @@ def barDF = { env ->
434
433
} as DataFetcher
435
434
```
436
435
437
-
By opting in to Chained DataLoaders, GraphQL Java will also calculate when to dispatch "delayed" DataLoaders.
438
-
439
-
The default value for the time to wait for these "delayed" DataLoaders is 500,000ns (`DEFAULT_BATCH_WINDOW_NANO_SECONDS_DEFAULT`). If you like, you can configure your own batch window via the method `delayedDataLoaderBatchWindowSize` in `GraphQLUnusualConfiguration.DataloaderConfig`.
440
-
441
-
Note that the case, where one DataLoader depends on another DataLoader all within the same DataFetcher, is unaffected by this batch window configuration. This window configuration only changes how long to wait for the "delayed" DataLoader case, where a DataLoader depends on another async task.
436
+
By opting in to Chained DataLoaders, GraphQL Java will also calculate when to dispatch "delayed" DataLoaders. These "delayed" DataLoaders will be enqueued for dispatch after the async task completes.
0 commit comments