clear deprecation warning on client error - fix test race

This commit is contained in:
bmc 2013-02-21 14:49:26 -06:00
parent cc84799c7a
commit 5c95886749
2 changed files with 6 additions and 1 deletions

View File

@ -80,11 +80,17 @@ var oldConnect = function(pool, client, cb) {
var tid = setTimeout(function() {
console.error(errorMessage);
}, alarmDuration);
var onError = function() {
clearTimeout(tid);
client.removeListener('drain', release);
};
var release = function() {
clearTimeout(tid);
pool.release(client);
client.removeListener('error', onError);
};
client.once('drain', release);
client.once('error', onError);
cb(null, client);
};

View File

@ -17,7 +17,6 @@ helper.pg.connect(helper.config, assert.success(function(client) {
assert.ok(error);
assert.ok(brokenClient);
assert.equal(client.id, brokenClient.id);
client.emit('drain');
helper.pg.end();
});
//kill the connection from client