From 7cd3566140bfd369a41cd5e2d6709eecfc54f12c Mon Sep 17 00:00:00 2001 From: Thomas Hayden Date: Mon, 11 Jun 2018 10:28:23 -0700 Subject: [PATCH] Fixed an issue where the client can sometimes attempt write to a readonly node. --- src/Shared/StackExchangeClientConnection.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Shared/StackExchangeClientConnection.cs b/src/Shared/StackExchangeClientConnection.cs index bbef7f06..d98b49c1 100644 --- a/src/Shared/StackExchangeClientConnection.cs +++ b/src/Shared/StackExchangeClientConnection.cs @@ -91,6 +91,12 @@ private object OperationExecutor(Func redisOperation) // Second call should pass if it was script not found issue return redisOperation.Invoke(); } + if (e.Message.Contains("READONLY")) + { + // Try once after reconnect + _sharedConnection.ForceReconnect(); + return redisOperation.Invoke(); + } throw; } }