File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed
Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -220,6 +220,11 @@ function terminate(terminateCb) {
220220function logStats ( ) {
221221 var self = this ;
222222 var averageTimeInQueue ;
223+
224+ if ( ! self . _isValid ) {
225+ console . log ( '_logStats must be called prior to terminating pool.' ) ;
226+ return ;
227+ }
223228
224229 if ( self . _enableStats !== true ) {
225230 console . log ( 'Pool statistics not enabled' ) ;
Original file line number Diff line number Diff line change @@ -905,4 +905,50 @@ describe('2. pool.js', function(){
905905 ) ;
906906 } ) ;
907907 } ) ;
908+
909+ describe ( '2.9 connection request queue (_enableStats & _logStats functionality)' , function ( ) {
910+ it ( '2.9.1 works after the pool as been terminated' , function ( done ) {
911+ oracledb . createPool (
912+ {
913+ externalAuth : credential . externalAuth ,
914+ user : credential . user ,
915+ password : credential . password ,
916+ connectString : credential . connectString ,
917+ poolMin : 0 ,
918+ poolMax : 1 ,
919+ poolIncrement : 1 ,
920+ poolTimeout : 1 ,
921+ queueRequests : true , //default
922+ _enableStats : true
923+ } ,
924+ function ( err , pool ) {
925+ should . not . exist ( err ) ;
926+
927+ pool . getConnection ( function ( err , conn ) {
928+ should . not . exist ( err ) ;
929+
930+ conn . execute ( 'select 1 from dual' , function ( err , result ) {
931+ should . not . exist ( err ) ;
932+
933+ conn . release ( function ( err ) {
934+ should . not . exist ( err ) ;
935+
936+ pool . terminate ( function ( err ) {
937+ should . not . exist ( err ) ;
938+
939+ try {
940+ pool . _logStats ( ) ;
941+ } catch ( err ) {
942+ should . not . exist ( err ) ;
943+ }
944+
945+ done ( ) ;
946+ } ) ;
947+ } ) ;
948+ } ) ;
949+ } ) ;
950+ }
951+ ) ;
952+ } ) ;
953+ } ) ;
908954} )
You can’t perform that action at this time.
0 commit comments