Skip to content

Commit b6c58bf

Browse files
committed
a bit more efficient load in case the strategy doesn't fit
1 parent 1ad0d47 commit b6c58bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/graphql/schema/DataLoaderWithContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public CompletableFuture<V> load(@NonNull K key, @Nullable Object keyContext) {
2929
// later than the dispatch, which results in a hanging DL
3030
CompletableFuture<V> result = super.load(key, keyContext);
3131
DataFetchingEnvironmentImpl dfeImpl = (DataFetchingEnvironmentImpl) dfe;
32-
int level = dfe.getExecutionStepInfo().getPath().getLevel();
33-
String path = dfe.getExecutionStepInfo().getPath().toString();
3432
DataFetchingEnvironmentImpl.DFEInternalState dfeInternalState = (DataFetchingEnvironmentImpl.DFEInternalState) dfeImpl.toInternal();
3533
if (dfeInternalState.getDataLoaderDispatchStrategy() instanceof PerLevelDataLoaderDispatchStrategy) {
3634
DeferredCallContext deferredCallContext = dfeInternalState.getDeferredCallContext();
35+
int level = dfe.getExecutionStepInfo().getPath().getLevel();
36+
String path = dfe.getExecutionStepInfo().getPath().toString();
3737
((PerLevelDataLoaderDispatchStrategy) dfeInternalState.dataLoaderDispatchStrategy).newDataLoaderLoadCall(path, level, delegate, dataLoaderName, key, deferredCallContext);
3838
}
3939
return result;

0 commit comments

Comments
 (0)