https://github.com/amitiwary999/worker-pool-go
https://github.com/amitiwary999/worker-pool-go
Last synced: about 22 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/amitiwary999/worker-pool-go
- Owner: amitiwary999
- Created: 2024-01-14T15:22:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-07T02:02:34.000Z (about 1 year ago)
- Last Synced: 2024-04-13T16:17:02.088Z (about 1 year ago)
- Language: Go
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# worker-pool-go
My implementation to try worker pool. Initial version is:
n number of goroutine is running and we keep adding the job in queue and any one goroutine take job from queue and do it.
Buffered channel is helpful where there is always some task on buffer even if all receiver are busy. but until all task is added in queue we can't do anything else.another version:
we used sync pool and manage a number of worker in pool. It take worker pool size, n, as input. At a time maximum n number of task process. When a worker is done, it is added again back to pool for other task. After expiry time we release the goroutine to save the resource. This is inspired from the `ants` library.