Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WorkerPool ¶
WorkerPool creates a waitgroup and a taskQueue for a worker pool. It will create "n" workers which will listen for Tasks on the taskQueue. The return value is the taskQueue and a wait function. Do not directly close the taskQueue, use the wait function. Clients should add new tasks to this taskQueue and call the wait function when done. If a worker fails with an error and continueOnError is false, the task context will be canceled, instructing the queue and workers to terminate. Tasks should check ctx as appropriate. The first error encountered will be returned from the wait function and all errors are logged at Warn level.
func WorkerPoolIgnoreError ¶ added in v0.6.9
WorkerPoolIgnoreError instantiates a WorkerPool with continueOnError=true and returns a wait function that captures and logs the error at Error level. This is convenient for defer.