mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
Merge pull request #543 from CartoDB/2.11-remove-ended-connections
Remove disconnected clients from the pool
This commit is contained in:
commit
b12dd4c420
10
lib/pool.js
10
lib/pool.js
@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user