Brian Carlson 27450d07e6 Throw on reconnect attempt
Clients are not reusable.  This changes the client to raise errors whenever you try to reconnect a client that's already been used.  They're cheap to create: just instantiate a new one (or use the pool) 😉.

Closes #1352
2017-07-15 11:02:09 -05:00

14 lines
362 B
JavaScript

"use strict";
var helper = require('./test-helper');
new helper.Suite().test('idle timeout', function () {
const config = Object.assign({}, helper.config, { idleTimeoutMillis: 50 })
const pool = new helper.pg.Pool(config)
pool.connect(assert.calls(function (err, client, done) {
assert(!err);
client.query('SELECT NOW()');
done();
}));
});