3 ms·
This is my first time posting code to Hacker News. I'd love to get any feedback on the quality and usefulness of the code as a package. Throttler fills the gap
by derekperkins 12y ago
This is my first time posting code to Hacker News. I'd love to get any feedback on the quality and usefulness of the code as a package.
Throttler fills the gap between sync.WaitGroup and manually monitoring your goroutines with channels. The API is almost identical to Wait Groups, but it allows you to set a max number of workers that can be running simultaneously. It uses channels internally to block until a job completes by calling Done() or until all jobs have been completed.
See a fully functional example on the playground at http://bit.ly/throttler-docs http://bit.ly/throttler-docs