ExecutorInstrumentation doesn't resolve fetchers which invokes a data loader
Describe the bug
ExecutorInstrumentation doesn't resolve fetchers which invokes a data loader.
To Reproduce
Sample Schema:
type Query {
account(id: String): Account
}
type Account {
id: String!
name: String!
transactions: [Transaction!]
}
type Transaction {
id: String!
accountId: String!
amount: numeric!
}
record Account(String id, String name) {}
record Transaction(String id, String accountId, double amount) {}
public static class AccountFetcher implements TrivialDataFetcher<Account> {
@Override
public Account get(DataFetchingEnvironment environment) throws Exception {
return new Account("id", "name");
}
}
public static class TransactionFetcher
implements DataFetcher<CompletionStage<List<Transaction>>> {
@Override
public CompletionStage<List<Transaction>> get(DataFetchingEnvironment environment)
throws Exception {
Account account = environment.getSource();
DataLoader<String, List<Transaction>> dataLoader =
environment.getDataLoader("transactionsByAccountIdLoader");
return dataLoader.load(account.id());
}
}
If I use ExecutorInstrumentation as an instrumentation, the properties of Account like id and name gets resolved correctly, but, transactions don't.
I think what's happening is the framework is somehow not dispatching the dataloaders.
I know its a Beta class, but I really wanted to use it so that I can control and tweak the thread pool used by the library.
Hello, this issue has been inactive for 60 days, so we're marking it as stale. If you would like to continue this discussion, please comment within the next 30 days or we'll close the issue.
Any update on this?
I have managed to make a reproduction here and I can confirm is is NOT working
See https://github.com/graphql-java/graphql-java/pull/3625
If I remove the async "fetch executor" in the test it works but with it in place it does not seem to dispatch and hence evercomplete
I have not as yet debugged deeply into why?
Any update on this?
Sorry no update -
The class is marked as
@Internal
@Beta
public class ExecutorInstrumentation extends SimplePerformantInstrumentation {
It was an experiement a long time ago and honestly its not a core part of the library - I would avoid it given it has problems
Hello, this issue has been inactive for 60 days, so we're marking it as stale. If you would like to continue this discussion, please comment within the next 30 days or we'll close the issue.
I think we should just remove the class - it does not work properly