Comparison to Our Original Approach
·2 mins
… continued from the previous post.
Refactor Our Original Approach #
What we have done to the previously can also be done to the approach using an error channel:
|
|
Making our function:
|
|
As we see we get a nearly identical result for the main function, witht the API neatly abstracting our soulution. One
difference is that we have to call all subtasks asynchronously, since we need Group.Wait
working on the error channel.
Summary #
We have seen two approaches to structured concurrency with nearly identical APIs.
… continued in the next post.