Fix error event handling for pooled clients

Do not emit error events if no listeners are present
This commit is contained in:
Patrick Mooney 2014-01-16 16:40:50 -06:00
parent 218150466f
commit 6b7906ce99
1 changed files with 3 additions and 1 deletions

View File

@ -47,7 +47,9 @@ function createPool(options, clientpool) {
client.on('error', function (err) {
client.removeAllListeners('connect');
client.removeAllListeners('connectTimeout');
clientpool.emit('error', err);
if (clientpool.listeners('error').length) {
clientpool.emit('error', err);
}
return callback(err);
});