mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-25 16:03:13 +00:00
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
14 lines
362 B
JavaScript
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();
|
|
}));
|
|
});
|