sourcegraph / conc

Better structured concurrency for go

Home Page:https://about.sourcegraph.com/blog/building-conc-better-structured-concurrency-for-go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

sudhirj opened this issue · 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.

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!