44 Commits

Author SHA1 Message Date
Brian Carlson
ee302cbcf1 Publish
- pg-cursor@2.9.0
 - pg-pool@3.6.0
 - pg-query-stream@4.4.0
 - pg@8.10.0
2023-03-06 14:18:02 -06:00
Ryan B. Harvey
810b125581
Emit a 'release' event when a connection is released back to the pool (#2845) 2023-03-06 12:32:13 -06:00
Brian C
47afe5cded
Attempt to fix timing test flake on older versions of node in CI (#2902) 2023-01-23 13:55:38 -08:00
Brian Carlson
c99fb2c127 Publish
- pg-cursor@2.7.4
 - pg-pool@3.5.2
 - pg-query-stream@4.2.4
 - pg@8.8.0
2022-08-23 11:36:18 -05:00
Brian C
a4ef6ce38c
Fix error handling test (#2789)
* Fix error handling test

#2569 introduced a bug in the test. The test never passed but because travis-ci lovingly broke the integration we had a long time ago the tests weren't run in CI until I merged.  So, this fixes the tests & does a better job cleaning up the query in an errored state.

* Update sponsors
2022-08-22 19:05:59 -05:00
Alex Zlotnik
8032fbad43
Catch errors client throws in pool (#2569)
* Catch errors client throws in pool

* Add a test

This test _should be_ right
2022-08-22 15:33:51 -05:00
ChrisWritable
3ca56027d3
Immediately unref() maxLifetimeSeconds Timeout object to prevent blocking allowExitOnIdle (#2721) 2022-05-12 19:05:02 -05:00
Brian Carlson
4fa7ee891a Publish
- pg-cursor@2.7.3
 - pg-pool@3.5.1
 - pg-query-stream@4.2.3
 - pg@8.7.3
2022-02-04 10:28:01 -06:00
Brian Carlson
9a61e9ac58 Format with prettier 2022-02-04 10:27:51 -06:00
Brian Carlson
6849cc6868 Publish
- pg-cursor@2.7.2
 - pg-pool@3.5.0
 - pg-query-stream@4.2.2
 - pg@8.7.2
2022-02-04 10:21:57 -06:00
ChrisWritable
8392918d7b
Add connection lifetime limit option and tests (#2698)
Co-authored-by: ChrisG0x20 <position0x45@hotmail.com>
2022-01-28 17:17:48 -06:00
Steffen Weidenhaus
2c3adf25f9
Update README.md (#2671)
Change `name` to `now` for time column
2021-12-17 00:15:26 -06:00
Brian M. Carlson
92b4d37926 Publish
- pg-cursor@2.7.1
 - pg-pool@3.4.1
 - pg-query-stream@4.2.1
 - pg@8.7.1
2021-07-27 17:33:19 -05:00
Brian C
86d31a6fad
Only call client.ref if it exists
* Only call client.ref if it exists. Fixes #2582

* Make test requiring port less flakey

* Bump port range

Fixes #2582
Fixes #2584
2021-07-27 17:27:05 -05:00
Brian M. Carlson
f3b0ee4c09 Publish
- pg-cursor@2.7.0
 - pg-pool@3.4.0
 - pg-query-stream@4.2.0
 - pg@8.7.0
2021-07-27 12:41:17 -05:00
Brian Crowell
684cd09bce
Allow Node to exit if the pool is idle (#2568)
Based on the suggestion from #2078. This adds ref/unref methods to the
Connection and Client classes and then uses them to allow the process to
exit if all of the connections in the pool are idle. This behavior is
controlled by the allowExitOnIdle flag to the Pool constructor; it defaults
to the old behavior.
2021-07-27 11:29:07 -05:00
Greg Brown
9d2c977ce9
Use _isFull instead of duplicating clients check (#2539)
Noticed that options.max is compared against client count directly, but there's a method wrapping it. I can't see any reason to duplicate it? And using _isFull means I can override that for the adaptive pooling idea I'm exploring :)
2021-06-22 09:55:21 -05:00
Charmander
7667e7c9e7
Fix and enable pool verify option test (#2528)
by not double-releasing.

Reviewed-by: Sehrope Sarkuni <sehrope@jackdb.com>
2021-05-27 23:37:07 +00:00
Charmander
8f0db306d9
Remove broken test (#2529)
It’s missing `co.wrap`, so it doesn’t actually run (Mocha does nothing with the paused generator). The test group that follows it, “using an ended pool”, covers the same thing anyway.
2021-04-27 15:34:08 -05:00
Brian M. Carlson
d459479382 Publish
- pg-connection-string@2.5.0
 - pg-cursor@2.6.0
 - pg-pool@3.3.0
 - pg-protocol@1.5.0
 - pg-query-stream@4.1.0
 - pg@8.6.0
2021-04-13 11:02:40 -05:00
Emily Marigold Klassen
5a41a56862
Add missing metadata to package.jsons (#2487)
Co-authored-by: Emily Marigold Klassen <forivall@users.noreply.github.com>
2021-03-12 08:23:13 -06:00
Brian M. Carlson
b6d69d5bc2 Publish
- pg-cursor@2.4.2
 - pg-pool@3.2.2
 - pg-query-stream@3.3.2
 - pg@8.4.2
2020-10-26 12:19:03 -05:00
Lewis Cowles
80c500ffbf Update packages/pg-pool/index.js
Co-authored-by: Charmander <~@charmander.me>
2020-10-20 12:53:25 -05:00
Lewis Cowles
fd2c3563a5 Security: simplify defineProperty non-enumerables
* `password` already has this set, but was a little long considering we only want to override default of one property
* `ssl.key` was showing up in tracebacks
2020-10-20 12:53:25 -05:00
Liam Aharon
f49db313c1
Fix typo in README.md 2020-06-30 17:13:41 +10:00
Brian M. Carlson
f3136a7d5d Publish
- pg-connection-string@2.2.3
 - pg-cursor@2.2.1
 - pg-pool@3.2.1
 - pg-protocol@1.2.4
 - pg-query-stream@3.1.1
 - pg@8.2.1
2020-05-15 18:33:34 -05:00
Brian M. Carlson
8404434279 Upgrade mocha 2020-05-13 11:49:37 -05:00
Brian M. Carlson
3f5bc58a86 Publish
- pg-connection-string@2.2.2
 - pg-cursor@2.1.11
 - pg-pool@3.2.0
 - pg-query-stream@3.0.8
 - pg@8.1.0
2020-05-08 10:42:57 -05:00
Andreas Lind
abb1f34020 Fix repository field in package.json 2020-05-05 09:26:42 +02:00
Brian M. Carlson
35328807e3 Publish
- pg-cursor@2.1.10
 - pg-pool@3.1.1
 - pg-protocol@1.2.2
 - pg-query-stream@3.0.7
 - pg@8.0.3
2020-04-22 11:04:51 -05:00
Johan Levin
7de8b49ad7 Refactor pg-pool to avoid potential memory leak
Reduce the closure scope captured by the "release once" lambda function
in _acquireClient so that it does not retain the pendingItem promise.
2020-04-15 11:46:15 +02:00
Brian M. Carlson
8591d94fcc Re-upgrade to prettier@2.x 2020-04-10 11:31:03 -05:00
Brian M. Carlson
6353affeca Downgrade to prettier@1.x to support node@8.x 2020-04-10 11:15:42 -05:00
Brian M. Carlson
c13cf81ee8 Lint pg & turn off semicolons 2020-04-10 10:47:57 -05:00
Brian M. Carlson
da03b3f905 Publish
- pg-cursor@2.1.9
 - pg-pool@3.1.0
 - pg-protocol@1.2.1
 - pg-query-stream@3.0.6
 - pg@8.0.2
2020-04-09 15:17:54 -05:00
Chris Chew
de81f71417 Added maxUses config option to Pool; Dev setup instructions in main README 2020-04-09 14:08:11 -05:00
Brian M. Carlson
a227d3e8d4 Publish
- pg-cursor@2.1.7
 - pg-pool@3.0.0
 - pg-query-stream@3.0.4
 - pg@8.0.0
2020-03-30 10:45:12 -05:00
Brian C
aafd8ac64e
8.0 Release (#2117)
* Drop support for EOL versions of node (#2062)

* Drop support for EOL versions of node

* Re-add testing for node@8.x

* Revert changes to .travis.yml

* Update packages/pg-pool/package.json

Co-Authored-By: Charmander <~@charmander.me>

Co-authored-by: Charmander <~@charmander.me>

* Remove password from stringified outputs (#2066)

* Remove password from stringified outputs

Theres a security concern where if you're not careful and you include your client or pool instance in console.log or stack traces it might include the database password.  To widen the pit of success I'm making that field non-enumerable.  You can still get at it...it just wont show up "by accident" when you're logging things now.

The backwards compatiblity impact of this is very small, but it is still technically somewhat an API change so...8.0.

* Implement feedback

* Fix more whitespace the autoformatter changed

* Simplify code a bit

* Remove password from stringified outputs (#2070)

* Keep ConnectionParameters’s password property writable

`Client` writes to it when `password` is a function.

* Avoid creating password property on pool options

when it didn’t exist previously.

* Allow password option to be non-enumerable

to avoid breaking uses like `new Pool(existingPool.options)`.

* Make password property definitions consistent

in formatting and configurability.

Co-authored-by: Charmander <~@charmander.me>

* Make `native` non-enumerable (#2065)

* Make `native` non-enumerable

Making it non-enumerable means less spurious "Cannot find module"
errors in your logs when iterating over `pg` objects.

`Object.defineProperty` has been available since Node 0.12.

See https://github.com/brianc/node-postgres/issues/1894#issuecomment-543300178

* Add test for `native` enumeration

Co-authored-by: Gabe Gorelick <gabegorelick@gmail.com>

* Use class-extends to wrap Pool (#1541)

* Use class-extends to wrap Pool

* Minimize diff

* Test `BoundPool` inheritance

Co-authored-by: Charmander <~@charmander.me>
Co-authored-by: Brian C <brian.m.carlson@gmail.com>

* Continue support for creating a pg.Pool from another instance’s options (#2076)

* Add failing test for creating a `BoundPool` from another instance’s settings

* Continue support for creating a pg.Pool from another instance’s options

by dropping the requirement for the `password` property to be enumerable.

* Use user name as default database when user is non-default (#1679)

Not entirely backwards-compatible.

* Make native client password property consistent with others

i.e. configurable.

* Make notice messages not an instance of Error (#2090)

* Make notice messages not an instance of Error

Slight API cleanup to make a notice instance the same shape as it was, but not be an instance of error.  This is a backwards incompatible change though I expect the impact to be minimal.

Closes #1982

* skip notice test in travis

* Pin node@13.6 for regression in async iterators

* Check and see if node 13.8 is still borked on async iterator

* Yeah, node still has changed edge case behavior on stream

* Emit notice messages on travis

* Revert "Revert "Support additional tls.connect() options (#1996)" (#2010)" (#2113)

This reverts commit 510a273ce45fb73d0355cf384e97ea695c8a5bcc.

* Fix ssl tests (#2116)

* Convert Query to an ES6 class (#2126)

The last missing `new` deprecation warning for pg 8.

Co-authored-by: Charmander <~@charmander.me>
Co-authored-by: Gabe Gorelick <gabegorelick@gmail.com>
Co-authored-by: Natalie Wolfe <natalie@lifewanted.com>
2020-03-30 10:31:35 -05:00
Brian M. Carlson
d9fcda8cf7 Publish
- pg-cursor@2.1.4
 - pg-pool@2.0.10
 - pg-query-stream@3.0.1
 - pg@7.18.0
2020-01-29 10:48:38 -06:00
Brian C
11ab1daadd
Close connection on SSL connection errors (#2082)
* Close connection on SSL connection errors

Fixes #2079

* Fix test

* Remove console.log

* Fix tests, implement same behavior for native client

* Fix tests
2020-01-29 10:18:20 -06:00
Brian C
727f1a0ee3
Do not return broken clients to the pool (#2083)
* Prevent requeuing a broken client

If a client is not queryable, the pool should prevent requeuing instead
of strictly enforcing errors to be propagated back to it.

* Write tests for change

* Use node 13.6 in travis

Some weird behavior changed w/ async iteration in node 13.7...I'm not sure if this was an unintentional break or not but it definitely diverges in behavior from node 12 and earlier versions in node 13...so for now going to run tests on 13.6 to unblock the tests from running while I track this down.

* Update packages/pg-pool/test/releasing-clients.js

Co-Authored-By: Charmander <~@charmander.me>

* Update .travis.yml

Co-authored-by: Johannes Würbach <johannes.wuerbach@googlemail.com>
Co-authored-by: Charmander <~@charmander.me>
2020-01-28 10:53:29 -06:00
Brian M. Carlson
af4d05445d Publish
- pg-cursor@2.1.1
 - pg-pool@2.0.9
 - pg-query-stream@2.1.1
 - pg@7.16.1
2019-12-28 17:16:42 +00:00
Brian M. Carlson
637bcf355c Cleanup things a bit 2019-12-27 17:52:28 +00:00
Brian M. Carlson
4c27ad294f Add 'packages/pg-pool/' from commit 'cb96ae2d6e37b1414df405d80258e0e2bafeaba0'
git-subtree-dir: packages/pg-pool
git-subtree-mainline: 69345eb96aa2552b288247960aa7126d41210eb6
git-subtree-split: cb96ae2d6e37b1414df405d80258e0e2bafeaba0
2019-12-27 04:01:42 +00:00