Skip to content

Commit ef13ca0

Browse files
committed
Allow calling release on connection removed from pool
1 parent 29e36bc commit ef13ca0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/PoolConnection.js

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ function PoolConnection(pool, options) {
1616
}
1717

1818
PoolConnection.prototype.release = function () {
19+
if (!this._pool || this._pool._closed) {
20+
return;
21+
}
22+
1923
return this._pool.releaseConnection(this);
2024
};
2125

test/integration/pool/test-destroy-connection.js

+2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ pool.getConnection(function(err, connection) {
1111
assert.ok(pool._allConnections.length == 0);
1212
assert.ok(!connection._pool);
1313

14+
assert.doesNotThrow(function () { connection.release(); });
15+
1416
pool.end();
1517
});

0 commit comments

Comments
 (0)