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 1.0.0 to 1.0.1

README.md

26

index.js

@@ -44,11 +44,2 @@ var genericPool = require('generic-pool')

}
client.queryAsync = function (text, values) {
return new this.Promise((resolve, reject) => {
client.query(text, values, function (err, res) {
err ? reject(err) : resolve(res)
})
})
}.bind(this)
cb(err, err ? null : client)

@@ -94,12 +85,11 @@ }.bind(this))

Pool.prototype.query = function (text, values) {
return this.take().then(function (client) {
return client.queryAsync(text, values)
.then(function (res) {
client.release()
return res
}).catch(function (error) {
client.release(error)
throw error
return new this.Promise(function (resolve, reject) {
this.connect(function (err, client, done) {
if (err) return reject(err)
client.query(text, values, function (err, res) {
done(err)
err ? reject(err) : resolve(res)
})
})
})
}.bind(this))
}

@@ -106,0 +96,0 @@

{
"name": "pg-pool",
"version": "1.0.0",
"version": "1.0.1",
"description": "Connection pool for node-postgres",

@@ -34,3 +34,3 @@ "main": "index.js",

"mocha": "^2.3.3",
"pg": "4.5.6",
"pg": "5.1.0",
"standard": "7.1.2",

@@ -37,0 +37,0 @@ "standard-format": "2.2.1"

var expect = require('expect.js')
var co = require('co')
var Promise = require('bluebird')
var _ = require('lodash')

@@ -62,3 +61,3 @@

expect(pool.pool.availableObjectsCount()).to.be(0)
var res = yield client.queryAsync('select $1::text as name', ['hi'])
var res = yield client.query('select $1::text as name', ['hi'])
expect(res.rows).to.eql([{ name: 'hi' }])

@@ -73,12 +72,7 @@ client.release()

var pool = new Pool({ poolSize: 9 })
var count = 0
while (count < 30) {
count++
pool.connect().then(function (client) {
client.queryAsync('select $1::text as name', ['hi']).then(function (res) {
client.release()
})
})
}
yield Promise.delay(100)
yield _.times(30).map(function * () {
var client = yield pool.connect()
yield client.query('select $1::text as name', ['hi'])
client.release()
})
expect(pool.pool.getPoolSize()).to.be(9)

@@ -85,0 +79,0 @@ return yield pool.end()

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