4 ms·
"But any general tips on when the consumer needs to cancel the rest of the work because of an error?" Yes, another channel which everyone watches for cancellat
by jerf 2y ago
"But any general tips on when the consumer needs to cancel the rest of the work because of an error?"
Yes, another channel which everyone watches for cancellation.
In modern Go, that should be a context and it's .Done() channel.
This is another "I'm not saying you suck because I did this myself a while before I figured it out", but having a channel around just to cancel things is fine. It doesn't cost anything significantly extra. I have some still in my code bases where I've just never had any reason to upgrade to contexts.