diff --git a/src/StackExchange.Redis/PhysicalBridge.cs b/src/StackExchange.Redis/PhysicalBridge.cs index 7b59481ef..8106266af 100644 --- a/src/StackExchange.Redis/PhysicalBridge.cs +++ b/src/StackExchange.Redis/PhysicalBridge.cs @@ -1200,15 +1200,20 @@ private WriteResult WriteMessageToServerInsideWriteLock(PhysicalConnection conne if (!connection.TransactionActive) { - var readmode = connection.GetReadModeCommand(isMasterOnly); - if (readmode != null) + // If we are executing AUTH, it means we are still unauthenticated + // Setting READONLY before AUTH always fails but we think it succeeded since + // we run it as Fire and Forget. + if (cmd != RedisCommand.AUTH) { - connection.EnqueueInsideWriteLock(readmode); - readmode.WriteTo(connection); - readmode.SetRequestSent(); - IncrementOpCount(); + var readmode = connection.GetReadModeCommand(isMasterOnly); + if (readmode != null) + { + connection.EnqueueInsideWriteLock(readmode); + readmode.WriteTo(connection); + readmode.SetRequestSent(); + IncrementOpCount(); + } } - if (message.IsAsking) { var asking = ReusableAskingCommand;