Open Tri0L opened 2 years ago
I am interested in doing something similar to this as well. Maybe there needs to be a worker interface
that we can use to create our own custom workers that will then be started and stopped by the pool.
Why are you using startWorker() and not worker()?
When starting a new worker, that new worker to run the new task directly, instead of pulling it off the work queue. Since the behavior was slightly different when starting, I split it into two functions. Other than that, there is no reason it cannot be the same function. That change to use the same function and goroutine was made in #59.
Hello!
Why are you using
startWorker()
and notworker()
?https://github.com/gammazero/workerpool/blob/85cc841576f67b14360c7298da3bcbbb76757020/workerpool.go#L192-L200
Maybe you have some examples, how I can pass db connection to worker? Not to specific task. Main idea is: Up some workers with 1 connection per worker and do sql requests(tasks) using worker sql connection.