Certainly it's important to limit the concurrency, and in your case you 
need to process the larger tasks first.

However, to me, the defining characteristic of a "worker pool" are:
1. workers are created before any tasks need to be done
2. the same worker handles multiple tasks sequentially
3. workers remain idle after tasks have been done

What you actually needed was just to limit the number of concurrent tasks, 
and you don't need a worker pool to do that.  You just need to ensure that 
when you launch a task, you block until the number of running concurrent 
tasks is below your limit.  For example, you can do that using a buffered 
channel of appropriate size.

The video is definitely worth watching.

-- 
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/feb4e0e7-208e-4adf-8210-92c31efcd916%40googlegroups.com.

Reply via email to