Add "UseTaskWhenAll" option#20
Merged
KuraiAndras merged 7 commits intoKuraiAndras:masterfrom Jun 16, 2025
Merged
Conversation
|
Please retry analysis of this Pull-Request directly on SonarQube Cloud |
Owner
|
Please update to the latest master so I can see the changes only in this branch |
Contributor
Author
|
Wait for the merge, I'm adding some info to the readme as well... |
KuraiAndras
approved these changes
Jun 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I am using this libaray in blazor, and due to the fact that the event handlers are run sequentially, it sometimes takes a while for components to update, because they have to wait for other components that subscribe to the same events.
I work around this now by changing most of my event handlers to void methods and use this pattern instead:
But just like mediatr now has its TaskWhenAllPublisher, I thought I make something similar for Courier.
This pr is the result.
When the new option "UseTaskWhenAll" is true, all the tasks are now gathered into a list, and then awaited for at the end with Task.WhenAll, in stead of sequentially.
I have also added a couple of tests.
Let me know if the naming is ok. The option could be named something like "PublishParallel" as well?
With this I would be able to use actual async event handlers again so I don't have to resort to the "InvokeAsync pattern" I talked about above.
This is based on #19