Routinepool is a simple Go library to start a worker pool. The example provided in the test illustrates everything what this worker pool can do. e.g. See number of active jobs, pending jobs, stop worker pool etc.
- Start worker pool
- Push tasks/work to the pool
- See active number of tasks
- See pending tasks
New()
- returns a new Pool pointer with all the configurations set, ready to be usedp.Start()
- starts the workerpool and waits for tasks to be pushedp.Push(<task>)
- pushes a work/task to the queuep.Active()
- returns the number of tasks which are actively runningp.Pending()
- returns the number of tasks which are pending in the queuep.Stop()
- gracefully shutsdown the workerpool, i.e. waits for the queue to be empty and shutdown