I'm trying to follow this tutorial/example here to setup my beanstalkd workers:
https://github.com/pjebs/beanstalkd-worker
My goal is to create a running go program that should listen to several beanstalkd tubes at once, and attempt to spawn workers on demand (and on available resources such as CPU, Memory etc). The workers actually simply a wrapper call for external workers (php, python, etc) to do certain jobs and catch back the returns.
The current issue is that when I try to run this program with go run test.go then the program would get stuck forever. It seems like I have made some mistake that cause my program to miss several wg.Done() that it should have called. I just cannot figure out where.
https://gist.github.com/yellow1912/afbd181a3dc2919f439d
(I'm a very beginner in Go, please feel free to criticize my code and suggest ways to improve)