Presumably the channel created by fastest returns the result of the fastest request method and then closes.
If a second result was obtained, your assumption could lead to a leak of fastest processes. Their results are never consumed. If they relied on all their results that needed to be destroyed, they would not stop.
Note that this can also happen if channel t selected in the alt! clause alt! .
The usual way to fix this would be to close channel c in the last go block with close! . Then they are postponed to the closed channel, and manufacturers can stop working.
The problem can also be resolved by implementing fastest . The process created in fastest itself can do put through alts! and timeout and stop working if the produced values are not consumed within a certain period of time.
I think Rich did not consider the problem on the slide in favor of a shorter example.
Leon Grapenthin
source share