Closed chiluap closed 7 years ago
You can actually use pool.totalCount
to get the number of connections in pg-pool@2.0. Where do I suggest counting? I'd like to go update that documentation.
It would be great to be able to monitor how connections are used, with a notification callback like this:
onConnectionCountChange(newCount) {
}
This will help planning the strategy for the size of the pool to be configured, or a change in how connections are used.
if you want to get a callback whenever a connection is created use the pool.on('connect')
event. That + checking pool.totalCount
should be all you need to monitor connection counts changing. 😄
Hi there,
nice work with the pg-pool.
just a thought:
for getting the number of active clients you suggest keeping a counter on the connect callback. I suggest counting the number of active clients via something like:
(b.t.w: I'am using the pool in an es2015 wrapper class. so don't mind the this.pool it is an instance of the pg-pool)
... just a thought.
keep up the good work
chiluap