a bit more efficient load in case the strategy doesn't fit by andimarek · Pull Request #4001 · graphql-java/graphql-java
Expand Up
@@ -29,11 +29,11 @@ public CompletableFuture<V> load(@NonNull K key, @Nullable Object keyContext) {
// later than the dispatch, which results in a hanging DL
CompletableFuture<V> result = super.load(key, keyContext);
DataFetchingEnvironmentImpl dfeImpl = (DataFetchingEnvironmentImpl) dfe;
int level = dfe.getExecutionStepInfo().getPath().getLevel();
String path = dfe.getExecutionStepInfo().getPath().toString();
DataFetchingEnvironmentImpl.DFEInternalState dfeInternalState = (DataFetchingEnvironmentImpl.DFEInternalState) dfeImpl.toInternal();
if (dfeInternalState.getDataLoaderDispatchStrategy() instanceof PerLevelDataLoaderDispatchStrategy) {
DeferredCallContext deferredCallContext = dfeInternalState.getDeferredCallContext();
int level = dfe.getExecutionStepInfo().getPath().getLevel();
String path = dfe.getExecutionStepInfo().getPath().toString();
((PerLevelDataLoaderDispatchStrategy) dfeInternalState.dataLoaderDispatchStrategy).newDataLoaderLoadCall(path, level, delegate, dataLoaderName, key, deferredCallContext);
}
return result;
Expand Down