File tree Expand file tree Collapse file tree 5 files changed +148
-104
lines changed Expand file tree Collapse file tree 5 files changed +148
-104
lines changed Original file line number Diff line number Diff line change @@ -158,10 +158,9 @@ var Driver = (function () {
158
158
// wrapper around Connection anyway, so it makes little difference.
159
159
160
160
// Queue up a 'reset', to ensure the next user gets a clean
161
- // session to work with. No need to flush, this will get sent
162
- // along with whatever the next thing the user wants to do with
163
- // this session ends up being, so we save the network round trip.
161
+ // session to work with.
164
162
conn . reset ( ) ;
163
+ conn . sync ( ) ;
165
164
166
165
// Return connection to the pool
167
166
conn . _release ( ) ;
Original file line number Diff line number Diff line change @@ -403,7 +403,19 @@ var Connection = (function () {
403
403
} , {
404
404
key : "reset" ,
405
405
value : function reset ( observer ) {
406
- this . _queueObserver ( observer ) ;
406
+ this . _isHandlingFailure = true ;
407
+ var self = this ;
408
+ var wrappedObs = {
409
+ onNext : observer ? observer . onNext : NO_OP ,
410
+ onError : observer ? observer . onError : NO_OP ,
411
+ onCompleted : function onCompleted ( ) {
412
+ self . _isHandlingFailure = false ;
413
+ if ( observer ) {
414
+ observer . onCompleted ( ) ;
415
+ }
416
+ }
417
+ } ;
418
+ this . _queueObserver ( wrappedObs ) ;
407
419
this . _packer . packStruct ( RESET ) ;
408
420
this . _chunker . messageBoundary ( ) ;
409
421
}
Original file line number Diff line number Diff line change @@ -118,10 +118,9 @@ class Driver {
118
118
// wrapper around Connection anyway, so it makes little difference.
119
119
120
120
// Queue up a 'reset', to ensure the next user gets a clean
121
- // session to work with. No need to flush, this will get sent
122
- // along with whatever the next thing the user wants to do with
123
- // this session ends up being, so we save the network round trip.
121
+ // session to work with.
124
122
conn . reset ( ) ;
123
+ conn . sync ( ) ;
125
124
126
125
// Return connection to the pool
127
126
conn . _release ( ) ;
Original file line number Diff line number Diff line change @@ -185,6 +185,8 @@ class Connection {
185
185
this . _unpacker . structMappers [ UNBOUND_RELATIONSHIP ] = _mappers . unboundRel ;
186
186
this . _unpacker . structMappers [ PATH ] = _mappers . path ;
187
187
188
+
189
+
188
190
let self = this ;
189
191
// TODO: Using `onmessage` and `onerror` came from the WebSocket API,
190
192
// it reads poorly and has several annoying drawbacks. Swap to having
@@ -341,7 +343,19 @@ class Connection {
341
343
342
344
/** Queue a RESET-message to be sent to the database */
343
345
reset ( observer ) {
344
- this . _queueObserver ( observer ) ;
346
+ this . _isHandlingFailure = true ;
347
+ let self = this ;
348
+ let wrappedObs = {
349
+ onNext : observer ? observer . onNext : NO_OP ,
350
+ onError : observer ? observer . onError : NO_OP ,
351
+ onCompleted : ( ) => {
352
+ self . _isHandlingFailure = false ;
353
+ if ( observer ) {
354
+ observer . onCompleted ( ) ;
355
+ }
356
+ }
357
+ } ;
358
+ this . _queueObserver ( wrappedObs ) ;
345
359
this . _packer . packStruct ( RESET ) ;
346
360
this . _chunker . messageBoundary ( ) ;
347
361
}
You can’t perform that action at this time.
0 commit comments