gammazero / workerpool

Concurrency limiting goroutine pool
MIT License
1.33k stars 138 forks source link

Add package `job` #41

Closed oze4 closed 4 years ago

oze4 commented 4 years ago

Per this issue

Is something like this what you had in mind?

It almost seems unnecessary to create a package for this.. Thoughts?

gammazero commented 4 years ago

This looks like what I was looking was suggesting in another thread of discussion. This looks like I nice clean means of defining a job, and you can wrap the job's function with whatever you want (entry/exit logging, execution time tracking, counters, etc.). The code looks good, and it is also very flexible. This means it can be used with any function execution mechanism, even a plain goroutine. For this reason it should not be part of the workerpool repo. You should use this code as a place to start your own utility to wrap asynchronous functions with whatever tooling you like.

Thank you, and happy coding

oze4 commented 4 years ago

I really appreciate your time and explanations. Your guidance has helped me a bunch and I am truly thankful. Cheers!