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.
Follow through on #1049
This attempts to simplify the dispatcher a bit where possible to no longer rely on the synchronous path. This PR attempts to find a good balance between allocating the necessary task lists with the number of items needed because that is beneficial compared to doing
Task.WhenAll
withSelect
andToArray
During the discussion with @andreasohlund and @PhilBastian we concluded the original problem would only really have been discovered if the following are true:
CreateMessageBatchAsync
yield) or the large message has to be put into a batch that is sent after the first batch was dispatchedGiven that we have not even the premium namespace in place currently, simplifying the dispatcher slightly to avoid such an error seems to be warranted.
I have also removed the yielding, since that was just a way to reproduce the previous problem. With the new structure this is no longer necessary.