mediocregopher / radix.v2

Redis client for Go
http://godoc.org/github.com/mediocregopher/radix.v2
MIT License
433 stars 92 forks source link

Don't panic when pool size is 0 #61

Closed pboyd closed 7 years ago

pboyd commented 7 years ago

I ran into a problem with where pool.New panics if size is 0. This change makes it so an empty pool isn't pinged. This seem like the right behavior (since, if I'm reading the code right, it would make a connection just to ping it).

And, yes, it's silly to make an empty pool. I didn't realize I was, until I started getting "divide by zero" errors this morning. But, it "works", it just doesn't re-use connections.

mediocregopher commented 7 years ago

Lol, you're right, it is silly to make a pool of size 0 :P but if you must......