27 Commits

Author SHA1 Message Date
Herman J. Radtke III
411869df65
pool.end() resolves before the last pool.query() (#3461)
* Pass callback to client.end

* Add test for pool.end method

* fix: remove excessive _pulseQueue call

* fix: context problem

* fix: test resolve should be called when the last client is removed

* fix: wait for pool.end()

Because when you don't pass a callback to .end() it always returns a promise

* fix: handle idle timeout test data race

---------

Co-authored-by: Asadbek Raimov <asadbekraimov642@gmail.com>
2025-05-29 17:12:24 -05:00
Brian C
9e7a5d97cf
Replace all usages of var with let / const - eslint auto applied (#3444) 2025-04-27 11:50:33 -05:00
Harish T
ff40638868
Support Min connection pool parameter #3009 (#3438)
* Support Min connection pool parameter #3009

* Remove extraneous change

* streamline code
2025-04-25 14:41:02 -05:00
Charmander
d8fb2f9c35
test: Avoid silencing errors from idle timeout test’s child process (#3419)
This hid the error fixed in #3263, for example.
2025-04-13 07:18:33 +00:00
Alex Anderson
9b510373a6
eslint: enable recommended ruleset (#3263) 2025-04-12 08:17:33 +00:00
Alex Anderson
1625861981
Remove unused imports (#3241)
* Remove unused imports

* reinstate test helper

---------

Co-authored-by: alxndrsn <alxndrsn>
2024-06-05 10:50:52 -05:00
Alex Anderson
16322c2d50
Fix eslint violations (#3078)
Co-authored-by: alxndrsn <alxndrsn>
2023-10-19 10:27:25 -05:00
Brian C
0870442776
Fix race condition in release event test for pool (#2969) 2023-05-01 09:15:20 -05: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 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
9a61e9ac58 Format with prettier 2022-02-04 10:27:51 -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
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
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
8404434279 Upgrade mocha 2020-05-13 11:49:37 -05: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
Chris Chew
de81f71417 Added maxUses config option to Pool; Dev setup instructions in main README 2020-04-09 14:08:11 -05: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
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