Skip to content

Commit a282065

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 56f13de commit a282065

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,14 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
443443
async _createSessionForRediscovery (routerAddress, bookmark) {
444444
try {
445445
const connection = await this._connectionPool.acquire(routerAddress)
446-
const connectionProvider = new SingleConnectionProvider(connection)
446+
447+
const databaseSpecificErrorHandler = ConnectionErrorHandler.create({
448+
errorCode: SESSION_EXPIRED,
449+
handleAuthorizationExpired: (error, address) => this._handleAuthorizationExpired(error, address)
450+
})
451+
452+
const connectionProvider = new SingleConnectionProvider(
453+
new DelegateConnection(connection, databaseSpecificErrorHandler))
447454

448455
const protocolVersion = connection.protocol().version
449456
if (protocolVersion < 4.0) {

0 commit comments

Comments
 (0)