Particular / NServiceBus.Transport.AzureServiceBus

Azure Service Bus transport
Other
22 stars 19 forks source link

Simplify dispatcher #1052

Closed danielmarbach closed 2 months ago

danielmarbach commented 2 months ago

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 with Select and ToArray

image

During the discussion with @andreasohlund and @PhilBastian we concluded the original problem would only really have been discovered if the following are true:

Given 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.