@@ -136,7 +136,7 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
136
136
* See {@link ConnectionProvider} for more information about this method and
137
137
* its arguments.
138
138
*/
139
- async acquireConnection ( { accessMode, database, bookmarks, impersonatedUser, onDatabaseNameResolved, auth, allowStickyConnection } = { } ) {
139
+ async acquireConnection ( { accessMode, database, bookmarks, impersonatedUser, onDatabaseNameResolved, auth } = { } ) {
140
140
let name
141
141
let address
142
142
const context = { database : database || DEFAULT_DB_NAME }
@@ -155,7 +155,6 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
155
155
bookmarks,
156
156
impersonatedUser,
157
157
auth,
158
- allowStickyConnection,
159
158
onDatabaseNameResolved : ( databaseName ) => {
160
159
context . database = context . database || databaseName
161
160
if ( onDatabaseNameResolved ) {
@@ -187,15 +186,11 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
187
186
const connection = await this . _connectionPool . acquire ( { auth } , address )
188
187
189
188
if ( auth ) {
190
- const stickyConnection = await this . _getStickyConnection ( {
189
+ await this . _verifyStickyConnection ( {
191
190
auth,
192
191
connection,
193
- address,
194
- allowStickyConnection
192
+ address
195
193
} )
196
- if ( stickyConnection ) {
197
- return stickyConnection
198
- }
199
194
return connection
200
195
}
201
196
@@ -275,9 +270,8 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
275
270
} )
276
271
}
277
272
278
- async verifyAuthentication ( { database, accessMode, auth, allowStickyConnection } ) {
273
+ async verifyAuthentication ( { database, accessMode, auth } ) {
279
274
return this . _verifyAuthentication ( {
280
- allowStickyConnection,
281
275
auth,
282
276
getAddress : async ( ) => {
283
277
const context = { database : database || DEFAULT_DB_NAME }
@@ -286,7 +280,6 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
286
280
accessMode,
287
281
database : context . database ,
288
282
auth,
289
- allowStickyConnection,
290
283
onDatabaseNameResolved : ( databaseName ) => {
291
284
context . database = context . database || databaseName
292
285
}
@@ -351,7 +344,7 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
351
344
} )
352
345
}
353
346
354
- _freshRoutingTable ( { accessMode, database, bookmarks, impersonatedUser, onDatabaseNameResolved, auth, allowStickyConnection } = { } ) {
347
+ _freshRoutingTable ( { accessMode, database, bookmarks, impersonatedUser, onDatabaseNameResolved, auth } = { } ) {
355
348
const currentRoutingTable = this . _routingTableRegistry . get (
356
349
database ,
357
350
( ) => new RoutingTable ( { database } )
@@ -363,10 +356,10 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
363
356
this . _log . info (
364
357
`Routing table is stale for database: "${ database } " and access mode: "${ accessMode } ": ${ currentRoutingTable } `
365
358
)
366
- return this . _refreshRoutingTable ( currentRoutingTable , bookmarks , impersonatedUser , onDatabaseNameResolved , auth , allowStickyConnection )
359
+ return this . _refreshRoutingTable ( currentRoutingTable , bookmarks , impersonatedUser , onDatabaseNameResolved , auth )
367
360
}
368
361
369
- _refreshRoutingTable ( currentRoutingTable , bookmarks , impersonatedUser , onDatabaseNameResolved , auth , allowStickyConnection ) {
362
+ _refreshRoutingTable ( currentRoutingTable , bookmarks , impersonatedUser , onDatabaseNameResolved , auth ) {
370
363
const knownRouters = currentRoutingTable . routers
371
364
372
365
if ( this . _useSeedRouter ) {
@@ -376,8 +369,7 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
376
369
bookmarks ,
377
370
impersonatedUser ,
378
371
onDatabaseNameResolved ,
379
- auth ,
380
- allowStickyConnection
372
+ auth
381
373
)
382
374
}
383
375
return this . _fetchRoutingTableFromKnownRoutersFallbackToSeedRouter (
@@ -386,8 +378,7 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
386
378
bookmarks ,
387
379
impersonatedUser ,
388
380
onDatabaseNameResolved ,
389
- auth ,
390
- allowStickyConnection
381
+ auth
391
382
)
392
383
}
393
384
@@ -397,8 +388,7 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
397
388
bookmarks ,
398
389
impersonatedUser ,
399
390
onDatabaseNameResolved ,
400
- auth ,
401
- allowStickyConnection
391
+ auth
402
392
) {
403
393
// we start with seed router, no routers were probed before
404
394
const seenRouters = [ ]
@@ -408,8 +398,7 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
408
398
currentRoutingTable ,
409
399
bookmarks ,
410
400
impersonatedUser ,
411
- auth ,
412
- allowStickyConnection
401
+ auth
413
402
)
414
403
415
404
if ( newRoutingTable ) {
@@ -421,8 +410,7 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
421
410
currentRoutingTable ,
422
411
bookmarks ,
423
412
impersonatedUser ,
424
- auth ,
425
- allowStickyConnection
413
+ auth
426
414
)
427
415
newRoutingTable = newRoutingTable2
428
416
error = error2 || error
@@ -442,16 +430,14 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
442
430
bookmarks ,
443
431
impersonatedUser ,
444
432
onDatabaseNameResolved ,
445
- auth ,
446
- allowStickyConnection
433
+ auth
447
434
) {
448
435
let [ newRoutingTable , error ] = await this . _fetchRoutingTableUsingKnownRouters (
449
436
knownRouters ,
450
437
currentRoutingTable ,
451
438
bookmarks ,
452
439
impersonatedUser ,
453
- auth ,
454
- allowStickyConnection
440
+ auth
455
441
)
456
442
457
443
if ( ! newRoutingTable ) {
@@ -462,8 +448,7 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
462
448
currentRoutingTable ,
463
449
bookmarks ,
464
450
impersonatedUser ,
465
- auth ,
466
- allowStickyConnection
451
+ auth
467
452
)
468
453
}
469
454
@@ -480,16 +465,14 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
480
465
currentRoutingTable ,
481
466
bookmarks ,
482
467
impersonatedUser ,
483
- auth ,
484
- allowStickyConnection
468
+ auth
485
469
) {
486
470
const [ newRoutingTable , error ] = await this . _fetchRoutingTable (
487
471
knownRouters ,
488
472
currentRoutingTable ,
489
473
bookmarks ,
490
474
impersonatedUser ,
491
- auth ,
492
- allowStickyConnection
475
+ auth
493
476
)
494
477
495
478
if ( newRoutingTable ) {
@@ -515,8 +498,7 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
515
498
routingTable ,
516
499
bookmarks ,
517
500
impersonatedUser ,
518
- auth ,
519
- allowStickyConnection
501
+ auth
520
502
) {
521
503
const resolvedAddresses = await this . _resolveSeedRouter ( seedRouter )
522
504
@@ -525,7 +507,7 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
525
507
address => seenRouters . indexOf ( address ) < 0
526
508
)
527
509
528
- return await this . _fetchRoutingTable ( newAddresses , routingTable , bookmarks , impersonatedUser , auth , allowStickyConnection )
510
+ return await this . _fetchRoutingTable ( newAddresses , routingTable , bookmarks , impersonatedUser , auth )
529
511
}
530
512
531
513
async _resolveSeedRouter ( seedRouter ) {
@@ -537,7 +519,7 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
537
519
return [ ] . concat . apply ( [ ] , dnsResolvedAddresses )
538
520
}
539
521
540
- async _fetchRoutingTable ( routerAddresses , routingTable , bookmarks , impersonatedUser , auth , allowStickyConnection ) {
522
+ async _fetchRoutingTable ( routerAddresses , routingTable , bookmarks , impersonatedUser , auth ) {
541
523
return routerAddresses . reduce (
542
524
async ( refreshedTablePromise , currentRouter , currentIndex ) => {
543
525
const [ newRoutingTable ] = await refreshedTablePromise
@@ -561,8 +543,7 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
561
543
currentRouter ,
562
544
bookmarks ,
563
545
impersonatedUser ,
564
- auth ,
565
- allowStickyConnection
546
+ auth
566
547
)
567
548
if ( session ) {
568
549
try {
@@ -587,20 +568,16 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
587
568
)
588
569
}
589
570
590
- async _createSessionForRediscovery ( routerAddress , bookmarks , impersonatedUser , auth , allowStickyConnection ) {
571
+ async _createSessionForRediscovery ( routerAddress , bookmarks , impersonatedUser , auth ) {
591
572
try {
592
- let connection = await this . _connectionPool . acquire ( { auth } , routerAddress )
573
+ const connection = await this . _connectionPool . acquire ( { auth } , routerAddress )
593
574
594
575
if ( auth ) {
595
- const stickyConnection = await this . _getStickyConnection ( {
576
+ await this . _verifyStickyConnection ( {
596
577
auth,
597
578
connection,
598
- address : routerAddress ,
599
- allowStickyConnection
579
+ address : routerAddress
600
580
} )
601
- if ( stickyConnection ) {
602
- connection = stickyConnection
603
- }
604
581
}
605
582
606
583
const databaseSpecificErrorHandler = ConnectionErrorHandler . create ( {
0 commit comments