Skip to content

Commit cee0df4

Browse files
author
dimov
committed
fix: implement pool_connection end
1 parent fdd5742 commit cee0df4

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

Diff for: lib/pool.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Pool extends EventEmitter {
127127
}
128128
for (let i = 0; i < this._allConnections.length; i++) {
129129
connection = this._allConnections.get(i);
130-
connection._realEnd(endCB);
130+
connection.end(endCB);
131131
}
132132
}
133133

@@ -205,7 +205,7 @@ class Pool extends EventEmitter {
205205
Date.now() - this._freeConnections.get(0).lastActiveTime >
206206
this.config.idleTimeout)
207207
) {
208-
this._freeConnections.get(0)._realEnd();
208+
this._freeConnections.get(0).end();
209209
}
210210
} finally {
211211
this._removeIdleTimeoutConnections();

Diff for: lib/pool_connection.js

+3-14
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,9 @@ class PoolConnection extends Connection {
3434
return new PromisePoolConnection(this, promiseImpl);
3535
}
3636

37-
end() {
38-
const err = new Error(
39-
'Calling conn.end() to release a pooled connection is ' +
40-
'deprecated. In next version calling conn.end() will be ' +
41-
'restored to default conn.end() behavior. Use ' +
42-
'conn.release() instead.'
43-
);
44-
this.emit('warn', err);
45-
// eslint-disable-next-line no-console
46-
console.warn(err.message);
47-
this.release();
37+
end(callback) {
38+
this._removeFromPool();
39+
super.end(callback);
4840
}
4941

5042
destroy() {
@@ -64,6 +56,3 @@ class PoolConnection extends Connection {
6456

6557
PoolConnection.statementKey = Connection.statementKey;
6658
module.exports = PoolConnection;
67-
68-
// TODO: Remove this when we are removing PoolConnection#end
69-
PoolConnection.prototype._realEnd = Connection.prototype.end;

0 commit comments

Comments
 (0)