ConnectionFailed isn't raised when single server node goes down (original) (raw)
StackExchange.Redis v1.0.187 (from nuget & from repo on March 18).
Started Redis locally, ran the following piece:
using (var c = await ConnectionMultiplexer.ConnectAsync("127.0.0.1")) { c.ConnectionFailed += (s, e) => Console.Write("failed"); c.ErrorMessage += (s, e) => Console.Write("error"); c.ConnectionRestored += (s,e) => Console.Write("restored"); var db = c.GetDatabase(); while (true) { try { byte[] value = await db.StringGetAsync("123"); Console.Write("."); } catch (Exception ex) { Console.Write("!"); } await Task.Delay(TimeSpan.FromSeconds(1)); } }
When Redis gets stopped while running the code, event handlers for ConnectionFailed and ErrorMessage are not raised. I get RedisConnectionException on StringGetAsync call. When Redis is started again, ConnectionRestored event handler is called twice (I guess there's two connections being kept around per node?).