Skip to content

Commit 1c0959b

Browse files
committed
Handle AuthorizationExpired during rediscovery
The connections to a server should not be sent back to the pool if an AuthenticationExpired failure happens. Sending the connection back to the pool will make the next work using the connection fails with the same error.
1 parent cf646a1 commit 1c0959b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/bolt-connection/src/connection-provider/connection-provider-routing.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,14 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
477477
async _createSessionForRediscovery (routerAddress, bookmark, impersonatedUser) {
478478
try {
479479
const connection = await this._connectionPool.acquire(routerAddress)
480-
const connectionProvider = new SingleConnectionProvider(connection)
480+
481+
const databaseSpecificErrorHandler = ConnectionErrorHandler.create({
482+
errorCode: SESSION_EXPIRED,
483+
handleAuthorizationExpired: (error, address) => this._handleAuthorizationExpired(error, address)
484+
})
485+
486+
const connectionProvider = new SingleConnectionProvider(
487+
new DelegateConnection(connection, databaseSpecificErrorHandler))
481488

482489
const protocolVersion = connection.protocol().version
483490
if (protocolVersion < 4.0) {

0 commit comments

Comments
 (0)