File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -60,13 +60,14 @@ Pool.prototype.connect = function (cb) {
6060 this . log ( 'acquire client' )
6161
6262 client . release = function ( err ) {
63+ delete client . release
6364 if ( err ) {
64- this . log ( 'release client. error:' , err )
65+ this . log ( 'destroy client. error:' , err )
6566 this . pool . destroy ( client )
67+ } else {
68+ this . log ( 'release client' )
69+ this . pool . release ( client )
6670 }
67- this . log ( 'release client' )
68- delete client . release
69- this . pool . release ( client )
7071 } . bind ( this )
7172
7273 if ( cb ) {
Original file line number Diff line number Diff line change @@ -89,7 +89,18 @@ describe('pool', function () {
8989 } ) )
9090
9191 it ( 'recovers from all errors' , co . wrap ( function * ( ) {
92- var pool = new Pool ( { poolSize : 9 } )
92+ var pool = new Pool ( {
93+ poolSize : 9 ,
94+ log : function ( str , level ) {
95+ // Custom logging function to ensure we are not causing errors or warnings
96+ // inside the `generic-pool` library.
97+ if ( level === 'error' || level === 'warn' ) {
98+ expect ( ) . fail ( 'An error or warning was logged from the generic pool library.\n' +
99+ 'Level: ' + level + '\n' +
100+ 'Message: ' + str + '\n' )
101+ }
102+ }
103+ } )
93104 var count = 0
94105
95106 while ( count ++ < 30 ) {
You can’t perform that action at this time.
0 commit comments