We break down why blocking on sending to a channel is not a bug, but a resilience mechanism:
backpressure. We understand how
cap(ch) turns into a “warehouse” of tasks/results, why large buffers can lead to
OOM, and how to design bounded queues in a pipeline
producer →
workers →
collector. In practice, we discuss choosing buffer sizes for
jobs/
results, a “buffer of 1” for signals/errors, and common mistakes (huge buffers, attempts to manage concurrency via
len(ch), leaks through references).