Closed rushmorem closed 8 years ago
This does seem useful! Could you add a similar method returning the number of idle connections? Looks good to me other than that.
OK, let me do that.
I have added idle_connections()
as well as config()
. I realised that there was no way to query the current configuration which helps make the most of these methods so I added it.
Thanks!
This method simply returns the number of connections currently open. This is very useful for health checking the pool as a whole. If, for example, this method consistently returns a number less than
min_idle
it means you are in trouble. If it falls to zero then none of your servers is up. A good use case for this is monitoring your servers.While the same info is included when you debug print the pool, which is very helpful during development to track down a bug, exposing this info in a public method like this makes it feasible to act on it in production.