Skip to content

Commit 00a720f

Browse files
authored
Better dataloader doco (graphql-java#1174)
* Added @OverRide as part of errorprone code health check * Revert "Added @OverRide as part of errorprone code health check" This reverts commit 38dfab1 * Moar doco on data loader
1 parent fd2454f commit 00a720f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/batching.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,17 @@ One thing to note is the above only works if you use `DataLoaderDispatcherInstru
149149
is called. If this was not in place, then all the promises to data will never be dispatched ot the batch loader function
150150
and hence nothing would ever resolve.
151151

152+
Data Loader only works with AsyncExecutionStrategy
153+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
154+
The only execution that works with DataLoader is ``graphql.execution.AsyncExecutionStrategy``. This is because this execution strategy knows
155+
then the most optimal time to dispatch() your load calls is. It does this by deeply tracking how many fields are outstanding and whether they
156+
are list values and so on.
157+
158+
Other execution strategies such as ``ExecutorServiceExecutionStrategy`` cant do this and hence if the data loader code detects
159+
you are not using ``AsyncExecutionStrategy`` then it will simple dispatch the data loader as each field is encountered. You
160+
may get `caching` of values but you will not get `batching` of them.
161+
162+
152163
Per Request Data Loaders
153164
^^^^^^^^^^^^^^^^^^^^^^^^
154165

0 commit comments

Comments
 (0)