-
-
Notifications
You must be signed in to change notification settings - Fork 749
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
IBatchScheduler default service change in HC14 (maybe intentional though?) #7810
Comments
This is not a bug and also not what is used when using HotChocolate. We decoupled the DataLoader from HotChocolate itself so it works also within a REST context. The When a GraphQL request however starts we are initializing a new DataLoaderScope within which the execution engine takes over dispatching.
if (scopeDataLoader)
{
// we ensure that at the begin of each execution there is a fresh batching scope.
services.InitializeDataLoaderScope();
} The initializer will then create a new DataLoader scope for the current execution that is initialized with the current batching handler for the current execution engine. internal static class DataLoaderServiceProviderExtensions
{
public static void InitializeDataLoaderScope(this IServiceProvider services)
{
var batchHandler = services.GetRequiredService<IBatchHandler>();
var dataLoaderScopeHolder = services.GetRequiredService<IDataLoaderScopeFactory>();
dataLoaderScopeHolder.BeginScope(batchHandler);
}
} There is more work in the pipeline on the scoping part which also moves the task tracking into a custom TaskScheduler: |
This isn't specifically about |
That is why we did not mention it in the migration guide. We will do further changes in this area, so be aware. |
What is your use-case btw? |
We are batching queries but not using |
Product
Hot Chocolate
Version
14.0.0
Link to minimal reproduction
n/a
Steps to reproduce
This might not be a bug but wanted to check.
In HC13, the default
IBatchScheduler
was registered toHotChocolate.Fetching.BatchScheduler
but it has changed toGreenDonut.AutoBatchScheduler
starting in HC14. The behavior between these are different enough to cause issues if unaware, didn't see anything mentioned in the release notes but may have missed it. Heads up to anyone running into such issues, useIBatchHandler
(which implementsIBatchScheduler
) instead since it is still registered toHotChocolate.Fetching.BatchScheduler
in HC14.If this change wasn't intentional, maybe the following line in
InternalServiceCollectionExtensions.cs -> TryAddDefaultBatchDispatcher()
should be changed?If this change was intentional, is there info somewhere explaining the change?
What is expected?
n/a
What is actually happening?
n/a
Relevant log output
Additional context
No response
The text was updated successfully, but these errors were encountered: