Hi,
In case the connection with Redis failed due to authentication failure (e.g. password is configured incorrectly due to key rotation),
the ConnectionFailureType that is returned is ConnectionFailureType.UnableToConnect.
My suggestion is in this case to return ConnectionFailureType.AuthenticationFailure
Thus, me as a client, can decide to disconnect Redis and retry with a new primary key that I have fetched.
The automatically retry mechanism of IMultiplexer would never success to connect with its own retry policy, but I don't want to catch any RedisConnectionException.
Is there any reason that the function returns ConnectionFailureType.UnableToConnect instead of ConnectionFailureType.AuthenticationFailure in this case?
internal static Exception UnableToConnect(ConnectionMultiplexer muxer, string failureMessage=null) { var sb = new StringBuilder("It was not possible to connect to the redis server(s)."); if (muxer != null) { if (muxer.AuthSuspect) sb.Append(" There was an authentication failure; check that passwords (or client certificates) are configured correctly."); else if (muxer.RawConfig.AbortOnConnectFail) sb.Append(" Error connecting right now. To allow this multiplexer to continue retrying until it's able to connect, use abortConnect=false in your connection string or AbortOnConnectFail=false; in your code."); } if (!string.IsNullOrWhiteSpace(failureMessage)) sb.Append(' ').Append(failureMessage.Trim()); return new RedisConnectionException(ConnectionFailureType.UnableToConnect, sb.ToString()); }Thanks,
Sagi
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4