|
|
|
@ -23,9 +23,14 @@ var pools = {
|
|
|
|
|
log: clientConfig.poolLog || defaults.poolLog,
|
|
|
|
|
create: function(cb) {
|
|
|
|
|
var client = new pools.Client(clientConfig);
|
|
|
|
|
// Ignore errors on pooled clients until they are connected.
|
|
|
|
|
client.on('error', Function.prototype);
|
|
|
|
|
client.connect(function(err) {
|
|
|
|
|
if(err) return cb(err, null);
|
|
|
|
|
|
|
|
|
|
// Remove the noop error handler after a connection has been established.
|
|
|
|
|
client.removeListener('error', Function.prototype);
|
|
|
|
|
|
|
|
|
|
//handle connected client background errors by emitting event
|
|
|
|
|
//via the pg object and then removing errored client from the pool
|
|
|
|
|
client.on('error', function(e) {
|
|
|
|
|