conc icon indicating copy to clipboard operation
conc copied to clipboard

Clarify if `Stream.Go` blocks while the pool is full?

Open sudhirj opened this issue 3 years ago • 1 comments

From what I can see Stream will block when calling Go if the internal pool is fully occupied, just wanted to make sure this was the case, and ask for it to be documented. If we're calling it for thousands for items for example, need to know that there will be automatic back-pressure.

sudhirj avatar Jan 13 '23 06:01 sudhirj

Yes, it blocks if WithMaxGoroutines has been configured and all goroutines in the pool are already handling a task. If WithMaxGoroutines has not been configured, the default is unlimited concurrency and it will never block. I'll add some docs for this, thanks!

camdencheek avatar Jan 13 '23 13:01 camdencheek