Revert "Non awaited task in GraphQL DataLoaderExtensions (#11536)" #11548
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reverts commit 5ba889e.
@sebastienros I reverted #11536 because first I didn't updated the right method, the one that uses a Task.WhenAll(), anyway If I remove the Task.WhenAll in the right extension method it works for a CPField with only one item (only CPField uses this method) otherwise it was blocking, you already tried to do exactly the same in #9769.
I noticed that the Task.WhenAll is not used to do concurrent queries but to grab all needed Ids, maybe this is here that concurrent accesses are done on our ContentItem Elements, notice that I was not able to repro #9330. If I remove the Task.WhenAll() and add some await, it tries to do a query for each Id and it is blocking on the 2nd one.
As I read GraphQL is more intended to provide a single item or a collection but both by an unique key, to support a multiple keys input they introduced an extension that exactly does what we do, i.e. they also use a Task.WhenAll().
For ListPart we use a CollectionBatchLoader that returns a collection but each group set being related to an unique key, the
ContainedPart.ListContentItemId
. For a CPField I could mimic the behavior of a ListPart by scope caching a relation between a guid and the item Ids of a given CPField, then I used this uid to retrieve the items. It works but for now if 2 CPFields reference the same item, this item is rendered once.Let me know if it is worth to work on it, maybe not as it seems that there is an incoming version upgrade of GraphQL.