File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,8 @@ class Driver {
144144 // notify Driver.onError callback about connection initialization errors
145145 this . onError ( error ) ;
146146 }
147+ // let's destroy this connection
148+ this . _destroyConnection ( connection ) ;
147149 // propagate the error because connection failed to connect / initialize
148150 throw error ;
149151 } ) ;
Original file line number Diff line number Diff line change @@ -79,6 +79,20 @@ describe('driver', () => {
7979 startNewTransaction ( driver ) ;
8080 } , 10000 ) ;
8181
82+ it ( 'should destroy failed connections' , done => {
83+ // Given
84+ driver = neo4j . driver ( 'bolt://local-host' , sharedNeo4j . authToken ) ;
85+
86+ const session = driver . session ( ) ;
87+
88+ session . run ( 'RETURN 1' ) . catch ( err => {
89+ expect ( driver . _openConnections ) . toEqual ( { } ) ;
90+
91+ done ( ) ;
92+ } ) ;
93+ } , 10000 ) ;
94+
95+
8296 it ( 'should fail with correct error message when connecting to port 80' , done => {
8397 if ( testUtils . isClient ( ) ) {
8498 // good error message is not available in browser
You can’t perform that action at this time.
0 commit comments