From 52aa25d8e8865ff4dac43d8acb174c404c479e2b Mon Sep 17 00:00:00 2001 From: Martin Kuba Date: Tue, 26 Apr 2016 15:41:11 -0700 Subject: [PATCH] added Client constructor back on pool to enable instrumentation (#998) --- lib/pool.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pool.js b/lib/pool.js index 358cb2c..d05a16f 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -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) {