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

detect problematic resurrections

parent 22fe529e
......@@ -261,6 +261,7 @@ protected IServer GetAnyMaster(ConnectionMultiplexer muxer)
muxer.ConnectionFailed += OnConnectionFailed;
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.Resurrecting += (e, t) => Writer.WriteLine($"Resurrecting {Format.ToString(e)} as {t}");
muxer.Closing += complete => Writer.WriteLine(complete ? "Closed" : "Closing...");
return muxer;
}
......
......@@ -467,6 +467,7 @@ internal void OnHeartbeat(bool ifConnectedOnly)
if (!ifConnectedOnly)
{
Multiplexer.Trace("Resurrecting " + ToString());
Multiplexer.OnResurrecting(ServerEndPoint?.EndPoint, ConnectionType);
GetConnection(null);
}
break;
......
......@@ -253,6 +253,7 @@ internal bool Validate(ConnectionMultiplexer multiplexer, RedisChannel channel)
internal event Action<string, Exception, string> MessageFaulted;
internal event Action<bool> Closing;
internal event Action<EndPoint, ConnectionType> Connecting;
internal event Action<EndPoint, ConnectionType> Resurrecting;
#else
internal event Action<string, Exception, string> MessageFaulted
{ // completely empty shell event, just to keep the test suite compiling
......@@ -266,6 +267,10 @@ internal bool Validate(ConnectionMultiplexer multiplexer, RedisChannel channel)
{ // completely empty shell event, just to keep the test suite compiling
add { } remove { }
}
internal event Action<EndPoint, ConnectionType> Resurrecting
{ // completely empty shell event, just to keep the test suite compiling
add { } remove { }
}
#endif
[Conditional("TEST")]
......@@ -289,6 +294,13 @@ internal void OnConnecting(EndPoint endpoint, ConnectionType connectionType)
{
#if TEST
Connecting?.Invoke(endpoint, connectionType);
#endif
}
[Conditional("TEST")]
internal void OnResurrecting(EndPoint endpoint, ConnectionType connectionType)
{
#if TEST
Resurrecting.Invoke(endpoint, connectionType);
#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