Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pg-pool

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-pool - npm Package Compare versions

Comparing version 2.0.7 to 2.0.8

24

index.js

@@ -28,6 +28,2 @@ 'use strict'

function throwOnRelease () {
throw new Error('Release called on client which has already been released to the pool.')
}
function promisify (Promise, callback) {

@@ -252,3 +248,3 @@ if (callback) {

if (released) {
throwOnRelease()
throw new Error('Release called on client which has already been released to the pool.')
}

@@ -325,2 +321,3 @@

cb = response.callback
this.connect((err, client) => {

@@ -330,5 +327,22 @@ if (err) {

}
let clientReleased = false
const onError = (err) => {
if (clientReleased) {
return
}
clientReleased = true
client.release(err)
cb(err)
}
client.once('error', onError)
this.log('dispatching query')
client.query(text, values, (err, res) => {
this.log('query dispatched')
client.removeListener('error', onError)
if (clientReleased) {
return
}
clientReleased = true
client.release(err)

@@ -335,0 +349,0 @@ if (err) {

{
"name": "pg-pool",
"version": "2.0.7",
"version": "2.0.8",
"description": "Connection pool for node-postgres",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -35,3 +35,2 @@ # pg-pool

max: 20, // set pool max size to 20
min: 4, // set min pool size to 4
idleTimeoutMillis: 1000, // close idle clients after 1 second

@@ -38,0 +37,0 @@ connectionTimeoutMillis: 1000, // return an error after 1 second if connection could not be established

@@ -229,2 +229,17 @@ 'use strict'

})
it('handles post-checkout client failures in pool.query', (done) => {
const pool = new Pool({ max: 1 })
pool.on('error', () => {
// We double close the connection in this test, prevent exception caused by that
})
pool.query('SELECT pg_sleep(5)', [], (err) => {
expect(err).to.be.an(Error)
done()
})
setTimeout(() => {
pool._clients[0].end()
}, 1000)
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc