added Client constructor back on pool to enable instrumentation (#998)

This commit is contained in:
Martin Kuba 2016-04-26 15:41:11 -07:00 committed by Brian C
parent fe6f32a6e7
commit 52aa25d8e8

View File

@ -6,6 +6,7 @@ var genericPool = require('generic-pool');
module.exports = function(Client) {
var pools = {
Client: Client,
//dictionary of all key:pool pairs
all: {},
//reference to the client constructor - can override in tests or for require('pg').native
@ -23,7 +24,7 @@ module.exports = function(Client) {
reapIntervalMillis: clientConfig.reapIntervalMillis || defaults.reapIntervalMillis,
log: clientConfig.poolLog || defaults.poolLog,
create: function(cb) {
var client = new Client(clientConfig);
var client = new pools.Client(clientConfig);
// Ignore errors on pooled clients until they are connected.
client.on('error', Function.prototype);
client.connect(function(err) {