Merge pull request #543 from CartoDB/2.11-remove-ended-connections

Remove disconnected clients from the pool
This commit is contained in:
Brian C 2014-03-22 10:47:53 -05:00
commit b12dd4c420

View File

@ -33,10 +33,20 @@ var pools = {
pool.destroy(client);
});
// Remove connection from pool on disconnect
client.on('end', function(e) {
// Do not enter infinite loop between pool.destroy
// and client 'end' event...
if ( ! client._destroying ) {
pool.destroy(client);
}
});
return cb(null, client);
});
},
destroy: function(client) {
client._destroying = true;
client.end();
}
});