Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExecutorInstrumentation doesn't resolve fetchers which invokes a data loader #3252

Open
vivekkothari opened this issue Jun 16, 2023 · 2 comments

Comments

@vivekkothari
Copy link

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.

Copy link

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.

@github-actions github-actions bot added the Stale label Nov 22, 2023
@vivekkothari
Copy link
Author

Any update on this?

@github-actions github-actions bot removed the Stale label Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@vivekkothari and others