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

Revert "Non awaited task in GraphQL DataLoaderExtensions (#11536)" #11548

Merged
merged 1 commit into from
Apr 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using GraphQL.DataLoader;

Expand All @@ -18,15 +19,9 @@ public static Task<T[]> LoadAsync<TKey, T>(this IDataLoader<TKey, T> dataLoader,
return Task.WhenAll(tasks);
}

public static async Task<T[]> LoadAsync<TKey, T>(this IDataLoader<TKey, T> dataLoader, params TKey[] keys)
public static Task<T[]> LoadAsync<TKey, T>(this IDataLoader<TKey, T> dataLoader, params TKey[] keys)
{
var tasks = new T[keys.Length];
for (var i = 0; i < keys.Length; i++)
{
tasks[i] = await dataLoader.LoadAsync(keys[i]);
}

return tasks;
return dataLoader.LoadAsync(keys.AsEnumerable());
}
}
}