Commit 776845f3 authored by Marc Gravell's avatar Marc Gravell

detect problematic resurrections

parent 22fe529e
...@@ -261,6 +261,7 @@ protected IServer GetAnyMaster(ConnectionMultiplexer muxer) ...@@ -261,6 +261,7 @@ protected IServer GetAnyMaster(ConnectionMultiplexer muxer)
muxer.ConnectionFailed += OnConnectionFailed; muxer.ConnectionFailed += OnConnectionFailed;
muxer.MessageFaulted += (msg, ex, origin) => Writer?.WriteLine($"Faulted from '{origin}': '{msg}' - '{(ex == null ? "(null)" : ex.Message)}'"); muxer.MessageFaulted += (msg, ex, origin) => Writer?.WriteLine($"Faulted from '{origin}': '{msg}' - '{(ex == null ? "(null)" : ex.Message)}'");
muxer.Connecting += (e, t) => Writer.WriteLine($"Connecting to {Format.ToString(e)} as {t}"); muxer.Connecting += (e, t) => Writer.WriteLine($"Connecting to {Format.ToString(e)} as {t}");
muxer.Resurrecting += (e, t) => Writer.WriteLine($"Resurrecting {Format.ToString(e)} as {t}");
muxer.Closing += complete => Writer.WriteLine(complete ? "Closed" : "Closing..."); muxer.Closing += complete => Writer.WriteLine(complete ? "Closed" : "Closing...");
return muxer; return muxer;
} }
......
...@@ -467,6 +467,7 @@ internal void OnHeartbeat(bool ifConnectedOnly) ...@@ -467,6 +467,7 @@ internal void OnHeartbeat(bool ifConnectedOnly)
if (!ifConnectedOnly) if (!ifConnectedOnly)
{ {
Multiplexer.Trace("Resurrecting " + ToString()); Multiplexer.Trace("Resurrecting " + ToString());
Multiplexer.OnResurrecting(ServerEndPoint?.EndPoint, ConnectionType);
GetConnection(null); GetConnection(null);
} }
break; break;
......
...@@ -253,6 +253,7 @@ internal bool Validate(ConnectionMultiplexer multiplexer, RedisChannel channel) ...@@ -253,6 +253,7 @@ internal bool Validate(ConnectionMultiplexer multiplexer, RedisChannel channel)
internal event Action<string, Exception, string> MessageFaulted; internal event Action<string, Exception, string> MessageFaulted;
internal event Action<bool> Closing; internal event Action<bool> Closing;
internal event Action<EndPoint, ConnectionType> Connecting; internal event Action<EndPoint, ConnectionType> Connecting;
internal event Action<EndPoint, ConnectionType> Resurrecting;
#else #else
internal event Action<string, Exception, string> MessageFaulted internal event Action<string, Exception, string> MessageFaulted
{ // completely empty shell event, just to keep the test suite compiling { // completely empty shell event, just to keep the test suite compiling
...@@ -266,6 +267,10 @@ internal bool Validate(ConnectionMultiplexer multiplexer, RedisChannel channel) ...@@ -266,6 +267,10 @@ internal bool Validate(ConnectionMultiplexer multiplexer, RedisChannel channel)
{ // completely empty shell event, just to keep the test suite compiling { // completely empty shell event, just to keep the test suite compiling
add { } remove { } add { } remove { }
} }
internal event Action<EndPoint, ConnectionType> Resurrecting
{ // completely empty shell event, just to keep the test suite compiling
add { } remove { }
}
#endif #endif
[Conditional("TEST")] [Conditional("TEST")]
...@@ -289,6 +294,13 @@ internal void OnConnecting(EndPoint endpoint, ConnectionType connectionType) ...@@ -289,6 +294,13 @@ internal void OnConnecting(EndPoint endpoint, ConnectionType connectionType)
{ {
#if TEST #if TEST
Connecting?.Invoke(endpoint, connectionType); Connecting?.Invoke(endpoint, connectionType);
#endif
}
[Conditional("TEST")]
internal void OnResurrecting(EndPoint endpoint, ConnectionType connectionType)
{
#if TEST
Resurrecting.Invoke(endpoint, connectionType);
#endif #endif
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment