brianc / node-pg-pool

A connection pool for node-postgres

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problems with config.min

thosaa opened this issue · comments

Hi
I'm having trouble with the config.min setting, which is shown in the README file at https://github.com/brianc/node-pg-pool/blob/master/README.md as 'min: 4, // set min pool size to 4'.

I was expecting that when this config was used:

config = {
    // connection params leaved out
    keepAlive: true, 
    ssl: true,
    max: 10, 
    min: 2, 
    idleTimeoutMillis: 20000
};

the pool would initiate two clients when the first client was requested and maintain any number of clients between min and max.
The is the behaviour that I'm seeing in Java using the C3P0 pool manager; https://www.mchange.com/projects/c3p0/#basic_pool_configuration

Looking at the connect and remove events and outputting the totalCount, when only making one query using pool.query, there is only one connection made and it is released after the idleTimeoutMillis.

I did a quick look for "max" in the code and looked around for "min" the the nearby but with no results.

So I'm having doubt that this parameter is used at all?
Could someone please enlighten me on this?

Thanks

The README is out of date and needs to be updated. There is no min options anymore. Just max and idleTimeoutMillis.

Originally this module was built atop the generic-pool module that allowed for those options. It was subsequently rewritten to handle the pooling itself for more fine grained control over how errors are handled. See #67 for more details.

Okay. Thanks for info and link.