On Tue, Apr 13, 2021 at 3:00 PM Roman Leventov <leventov...@gmail.com> wrote:
> Jesper, a single channel works if I provision it with big enough capacity > (1000), but this feels like an antipattern which can break. > Yes. On the flip side though, unbounded channels are also dangerous if the producer(s) outpaces consumers. In a real system, you'll have to decide on an in-flight limit anyway, if you want your system to be stable. If you don't want a bound, just set the capacity at 1_000_000_000_000 or some number that's larger than the available RAM for the foreseeable future. Personally, I'd probably go with the flow control pattern. Also, the idea of using a checkout/checkin pattern on a 1-capacity channel circumvents most of these considerations. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAGrdgiX26Ndouk3ftafVmz_QH9Q9yVumOP%3DmdyHdvLUWKbJiXA%40mail.gmail.com.