Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgp.pg.defaults are not respected for pooling #703

Closed
bharkreader opened this issue Mar 18, 2020 · 6 comments
Closed

pgp.pg.defaults are not respected for pooling #703

bharkreader opened this issue Mar 18, 2020 · 6 comments

Comments

@bharkreader
Copy link

Expected behavior

pgp.pg.defaults.idleTimeoutMillis = 60000;
pgp.pg.defaults.max = 20;
dbInstance = pgp(CONFIG.dbConnectionString);
console.log(dbInstance.$pool.options.idleTimeoutMillis)
console.log(dbInstance.$pool.options.max)
// I expect it to print 60000 and 20

Actual behavior

pgp.pg.defaults.idleTimeoutMillis = 60000;
pgp.pg.defaults.max = 20;
dbInstance = pgp(CONFIG.dbConnectionString);
console.log(dbInstance.$pool.options.idleTimeoutMillis)
console.log(dbInstance.$pool.options.max)
// it actually prints 10000 and 10

Steps to reproduce

pgp.pg.defaults.idleTimeoutMillis = 60000;
pgp.pg.defaults.max = 20;
dbInstance = pgp(CONFIG.dbConnectionString);
console.log(dbInstance.$pool.options.idleTimeoutMillis)
console.log(dbInstance.$pool.options.max)

Environment

  • Version of pg-promise: 10.3.5
  • OS type (Linux/Windows/Mac): Mac
  • Version of Node.js: 10.16.0

FWIW, I think this bug is a bug with pg-pool and I filed an issue there: brianc/node-postgres#2139

But I'm not sure if or when it will get fixed, so we might want to update the documentation to mention that these values can be overridden by this instead:

dbInstance.$pool.options.idleTimeoutMillis = 60000;
dbInstance.$pool.options.max = 20;
@vitaly-t
Copy link
Owner

Seems like duplicate of #699

@bharkreader
Copy link
Author

Ah, yeah, you're right. Sorry I missed that. There is still a reference to overriding pgp.pg.defaults in the README which caused some confusion. Maybe we should update that? "or override the default via pgp.pg.defaults.idleTimeoutMillis"

vitaly-t added a commit that referenced this issue Mar 19, 2020
@vitaly-t
Copy link
Owner

vitaly-t commented Mar 19, 2020

There is still a reference to overriding pgp.pg.defaults in the README which caused some confusion

This has been amended.

Other than that, I'm not sure there is anything that can be done from this side, short of removing idleTimeoutMillis from the TypeScript declarations for defaults. But that's a bug in the underlying driver, so we probably shouldn't.

@bharkreader
Copy link
Author

I think that's enough. Thanks!

@vitaly-t
Copy link
Owner

Cheers!

@vitaly-t
Copy link
Owner

vitaly-t commented Apr 1, 2020

I removed idleTimeoutMillis (within TypeScript) in v10.5.0. Within TypeScript, you now can only pass it in as part of the connection parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants