Merge pull request #620 from Jarvix/timeout_error_fix

Pool: Only call destroy on a client when it is not already being destroyed
This commit is contained in:
Brian C 2014-08-06 12:08:08 -04:00
commit be73773d36

View File

@ -30,7 +30,13 @@ var pools = {
//via the pg object and then removing errored client from the pool
client.on('error', function(e) {
pool.emit('error', e, client);
pool.destroy(client);
// If the client is already being destroyed, the error
// occurred during stream ending. Do not attempt to destroy
// the client again.
if (!client._destroying) {
pool.destroy(client);
}
});
// Remove connection from pool on disconnect