Skip to content

Commit dea4bbb

Browse files
authored
Merge pull request #3 from andrew-barnett/fix/pool-close
fix(pool-close): only close if connected
2 parents f17cf59 + bf9efd2 commit dea4bbb

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ class MsSql {
9191
* @returns Promise<>
9292
*/
9393
async close() {
94-
let pool = await this._pool();
95-
await pool.close();
96-
this._isConnected = false;
94+
if ( this._isConnected ) {
95+
let pool = await this._pool();
96+
await pool.close();
97+
this._isConnected = false;
98+
}
9799
}
98100

99101
/**
@@ -161,4 +163,4 @@ module.exports = {
161163
open: function(connection) {
162164
return new MsSql( connection );
163165
}
164-
};
166+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "database-js-mssql",
3-
"version": "0.2.2",
3+
"version": "0.2.3",
44
"description": "Database-js driver for SQL Server that works on Linux, Mac, and Windows",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)