Skip to content

Commit 5c95886

Browse files
committed
clear deprecation warning on client error - fix test race
1 parent cc84799 commit 5c95886

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/pool.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,17 @@ var oldConnect = function(pool, client, cb) {
8080
var tid = setTimeout(function() {
8181
console.error(errorMessage);
8282
}, alarmDuration);
83+
var onError = function() {
84+
clearTimeout(tid);
85+
client.removeListener('drain', release);
86+
};
8387
var release = function() {
8488
clearTimeout(tid);
8589
pool.release(client);
90+
client.removeListener('error', onError);
8691
};
8792
client.once('drain', release);
93+
client.once('error', onError);
8894
cb(null, client);
8995
};
9096

test/integration/connection-pool/error-tests.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ helper.pg.connect(helper.config, assert.success(function(client) {
1717
assert.ok(error);
1818
assert.ok(brokenClient);
1919
assert.equal(client.id, brokenClient.id);
20-
client.emit('drain');
2120
helper.pg.end();
2221
});
2322
//kill the connection from client

0 commit comments

Comments
 (0)