mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
Avoid loop between pool.destroy and client.end
This commit is contained in:
parent
9c5cd8d02d
commit
fb118cf069
@ -35,13 +35,18 @@ var pools = {
|
||||
|
||||
// Remove connection from pool on disconnect
|
||||
client.on('end', function(e) {
|
||||
pool.destroy(client);
|
||||
// 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