Potential deadlock in batch dataloader V13 #6010
-
I am using the a custom implementation (old style) batch data loader in my data access layer. I am using the GreenDonut package (13.0.5). I do the typical override of LoadBatchAsync. When I call LoadAsync on the instance of the loader my code just hangs, the execution never reaches LoadBatchAsync. It appears there is a deadlock internally somewhere. Has anyone experienced this? return await _userDataLoaderById.LoadAsync(userId, cancellationToken); protected override async Task<IReadOnlyDictionary<Guid, User>> LoadBatchAsync(IReadOnlyList userIds, CancellationToken cancellationToken) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Problem solved. The issue was that I was injecting the data loader into my repo in the data access layer. This requires a scheduler to be registered with the DI container as well. When using it this way, there is no need to add the data loader to the GraphQL middleware. |
Beta Was this translation helpful? Give feedback.
Problem solved. The issue was that I was injecting the data loader into my repo in the data access layer. This requires a scheduler to be registered with the DI container as well. When using it this way, there is no need to add the data loader to the GraphQL middleware.
services.AddScoped<IBatchScheduler, AutoBatchScheduler>();
services.AddScoped<IUserDataLoaderByUsername, UserDataLoaderByUsername>();
services.AddScoped<IUserDataLoaderById, UserDataLoaderById>();