Howdy!
I recently upgraded from an old, old version of pg-promise (which uses an old, old version of pg, before pg-pool existed) to the latest and found that my idle db connections were not staying alive as long. In the older version, they stayed alive for 30s and in the new version, they only stay alive for 10s.
I tried to track down where this was being set, and I found these defaults. The default value for idleTimeoutMillis is 30000:
|
idleTimeoutMillis: 30000, |
So I wondered, why are my connections timing out after only 10s? Then I looked in pg-pool to see where it pulled in the default values, and I couldn't find it. I found this instead:
|
this.options.idleTimeoutMillis = 10000 |
Aha! That's where the 10s value is being set. But my question is, why are pg.defaults not used here? Should we reference them instead of the hardcoded 10 (for max connections in the pool) and 10000? Or, should we at least update the 10000 to match the 30000 found in the defaults file?
Howdy!
I recently upgraded from an old, old version of pg-promise (which uses an old, old version of pg, before pg-pool existed) to the latest and found that my idle db connections were not staying alive as long. In the older version, they stayed alive for 30s and in the new version, they only stay alive for 10s.
I tried to track down where this was being set, and I found these defaults. The default value for idleTimeoutMillis is 30000:
node-postgres/packages/pg/lib/defaults.js
Line 46 in 11d7c59
So I wondered, why are my connections timing out after only 10s? Then I looked in pg-pool to see where it pulled in the default values, and I couldn't find it. I found this instead:
node-postgres/packages/pg-pool/index.js
Line 73 in 727f1a0
Aha! That's where the 10s value is being set. But my question is, why are pg.defaults not used here? Should we reference them instead of the hardcoded 10 (for max connections in the pool) and 10000? Or, should we at least update the 10000 to match the 30000 found in the defaults file?