File tree Expand file tree Collapse file tree 3 files changed +31
-4
lines changed Expand file tree Collapse file tree 3 files changed +31
-4
lines changed Original file line number Diff line number Diff line change @@ -387,9 +387,9 @@ export default class Connection {
387
387
this . _log . debug ( `${ this } closing` ) ;
388
388
}
389
389
390
- if ( this . _protocol ) {
391
- // protocol has been initialized
392
- // use it to notify the database about the upcoming close of the connection
390
+ if ( this . _protocol && this . isOpen ( ) ) {
391
+ // protocol has been initialized and this connection is healthy
392
+ // notify the database about the upcoming close of the connection
393
393
this . _protocol . prepareToClose ( NO_OP_OBSERVER ) ;
394
394
}
395
395
Original file line number Diff line number Diff line change @@ -367,6 +367,27 @@ describe('Connection', () => {
367
367
} ) . catch ( done . fail ) ;
368
368
} ) ;
369
369
370
+ it ( 'should not prepare broken connection to close' , done => {
371
+ connection = createConnection ( 'bolt://localhost' ) ;
372
+
373
+ connection . connect ( 'my-connection/9.9.9' , basicAuthToken ( ) )
374
+ . then ( ( ) => {
375
+ expect ( connection . _protocol ) . toBeDefined ( ) ;
376
+ expect ( connection . _protocol ) . not . toBeNull ( ) ;
377
+
378
+ // make connection seem broken
379
+ connection . _isBroken = true ;
380
+ expect ( connection . isOpen ( ) ) . toBeFalsy ( ) ;
381
+
382
+ connection . _protocol . prepareToClose = ( ) => {
383
+ throw new Error ( 'Not supposed to be called' ) ;
384
+ } ;
385
+
386
+ connection . close ( ( ) => done ( ) ) ;
387
+ } )
388
+ . catch ( error => done . fail ( error ) ) ;
389
+ } ) ;
390
+
370
391
function packedHandshakeMessage ( ) {
371
392
const result = alloc ( 4 ) ;
372
393
result . putInt32 ( 0 , 1 ) ;
Original file line number Diff line number Diff line change @@ -108,7 +108,13 @@ const additionalConfig = {
108
108
'dbms.connector.http.listen_address' : 'localhost:7474' ,
109
109
110
110
// shorten the default time to wait for the bookmark from 30 to 5 seconds
111
- 'dbms.transaction.bookmark_ready_timeout' : '5s'
111
+ 'dbms.transaction.bookmark_ready_timeout' : '5s' ,
112
+
113
+ // enable GC logging
114
+ 'dbms.logs.gc.enabled' : true ,
115
+
116
+ // enable query logging
117
+ 'dbms.logs.query.enabled' : true
112
118
} ;
113
119
114
120
const neoCtrlVersionParam = '-e' ;
You can’t perform that action at this time.
0 commit comments