Skip to content

Commit

Permalink
fixup! Add idleConnectionTimeout to pool options
Browse files Browse the repository at this point in the history
Use conn.end instead of conn.destroy for closing idle connections
  • Loading branch information
dicearr committed May 31, 2019
1 parent fc44254 commit 6633202
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/PoolConnection.js
Expand Up @@ -5,6 +5,8 @@ var Events = require('events');
module.exports = PoolConnection;
inherits(PoolConnection, Connection);

function _noop() {}

function PoolConnection(pool, options) {
Connection.call(this, options);
this._pool = pool;
Expand Down Expand Up @@ -34,7 +36,7 @@ PoolConnection.prototype.release = function release() {

if (this._pool.config.idleConnectionTimeout) {
this._idleTimeout = setTimeout(
this.destroy.bind(this),
this._realEnd.bind(this, _noop),
this._pool.config.idleConnectionTimeout
);
}
Expand Down

0 comments on commit 6633202

Please sign in to comment.