-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from digitalBush/feature-empty-pool
feat: add ability to disable pool.
- Loading branch information
Showing
6 changed files
with
49 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { config } = testHelpers; | ||
|
||
const skwell = require( "src" ); | ||
describe( "No Pooling - Integration", () => { | ||
let sql; | ||
before( async () => { | ||
const emptyPoolConfig = Object.assign( {}, config, { pool: false } ); | ||
sql = await skwell.connect( emptyPoolConfig ); | ||
} ); | ||
|
||
after( () => { | ||
return sql.dispose(); | ||
} ); | ||
|
||
it( "should not reuse the same connection", async () => { | ||
const query = "select connection_id from sys.dm_exec_connections where session_id = @@spid"; | ||
|
||
const cid1 = await sql.queryValue( query ); | ||
const cid2 = await sql.queryValue( query ); | ||
cid1.should.not.equal( cid2 ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const EventEmitter = require( "events" ); | ||
class EmptyPool extends EventEmitter { | ||
|
||
constructor( { create, destroy } ) { | ||
super(); | ||
|
||
this.acquire = create; | ||
this.release = destroy; | ||
} | ||
|
||
drain() { return Promise.resolve(); } | ||
clear() { /* Nothing to do */ } | ||
|
||
} | ||
|
||
module.exports = EmptyPool; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters