diff --git a/README.md b/README.md index 2331fc9..d82e9fe 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,9 @@ The following method is added to the Tedious [Connection](http://pekim.github.co ### Connection.release() Release the connect back to the pool to be used again +## Version 0.3.6 Changes +* bug fix only + ## Version 0.3.5 Changes * `poolConfig` option `min` is limited to less than `max` diff --git a/lib/connection-pool.js b/lib/connection-pool.js index 53f5705..fb2dd75 100644 --- a/lib/connection-pool.js +++ b/lib/connection-pool.js @@ -83,6 +83,10 @@ function createConnection(pooled) { pooled.status = RETRY; pooled.con = undefined; + if (pooled.timeout) { + clearTimeout(pooled.timeout); + pooled.timeout = undefined; + } connection.removeAllListeners('end'); connection.close(); @@ -199,10 +203,14 @@ ConnectionPool.prototype.acquire = function (callback) { function setUsed(pooled, waiter) { pooled.status = USED; - if (pooled.timeout) + if (pooled.timeout) { clearTimeout(pooled.timeout); - if (waiter.timeout) + pooled.timeout = undefined; + } + if (waiter.timeout) { clearTimeout(waiter.timeout); + waiter.timeout = undefined; + } waiter.callback(null, pooled.con); } @@ -216,8 +224,6 @@ function setFree(pooled) { }, this.idleTimeout); } - - ConnectionPool.prototype.release = function(connection) { if (this.drained) //pool has been drained return; diff --git a/package.json b/package.json index 04054a5..343f7f2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tedious-connection-pool", - "version": "0.3.5", + "version": "0.3.6", "description": "Connection Pool for tedious.", "main": "lib/connection-pool.js", "scripts": {