mycodesmells / golang-examples

126 stars 48 forks source link

defer conn.Close() #6

Open jrots opened 3 years ago

jrots commented 3 years ago

Hi was reading your article here, https://mycodesmells.com/post/pooling-grpc-connections and checking the code -
I was wondering doesn't this peace of code: https://github.com/mycodesmells/golang-examples/blob/37200fe1d687e1f7b8a96fd788e13dc8221083ac/k8s/grpc-pooling/employer/main.go#L72 close the connection in the grpc worker pool each time after a power request? beating the purpose of having a worker pool with long open connections/ clients? Thx!

slomek commented 3 years ago

Hi @jrots, That is a very good point, I must have missed that. I’m currently having some time off, but if you feel like fixing it go ahead and give it a try, PRs are welcome 😉 (especially if you are into Hacktoberfest 🙂) If not, I’ll take care of this when I find some time.