Commit 76326ba6 authored by Nick Craver's avatar Nick Craver

Better fix for TestQuit

Lines up with behaviors elsewhere - we already have semantics for failures here...following along.
parent bf0a037d
...@@ -547,7 +547,7 @@ internal WriteResult WriteMessageTakingWriteLock(PhysicalConnection physical, Me ...@@ -547,7 +547,7 @@ internal WriteResult WriteMessageTakingWriteLock(PhysicalConnection physical, Me
{ {
result = WriteMessageToServerInsideWriteLock(physical, next); result = WriteMessageToServerInsideWriteLock(physical, next);
} }
physical.WakeWriterAndCheckForThrottle(); result = physical.WakeWriterAndCheckForThrottle();
} }
finally finally
{ {
......
...@@ -270,9 +270,8 @@ public Task FlushAsync() ...@@ -270,9 +270,8 @@ public Task FlushAsync()
return Task.CompletedTask; return Task.CompletedTask;
} }
public Exception RecordConnectionFailed(ConnectionFailureType failureType, Exception innerException = null, [CallerMemberName] string origin = null) public void RecordConnectionFailed(ConnectionFailureType failureType, Exception innerException = null, [CallerMemberName] string origin = null)
{ {
Exception ex = innerException;
IdentifyFailureType(innerException, ref failureType); IdentifyFailureType(innerException, ref failureType);
if (failureType == ConnectionFailureType.InternalFailure) OnInternalError(innerException, origin); if (failureType == ConnectionFailureType.InternalFailure) OnInternalError(innerException, origin);
...@@ -331,7 +330,7 @@ void add(string lk, string sk, string v) ...@@ -331,7 +330,7 @@ void add(string lk, string sk, string v)
add("Last-Global-Heartbeat", "global", ConnectionMultiplexer.LastGlobalHeartbeatSecondsAgo + "s ago"); add("Last-Global-Heartbeat", "global", ConnectionMultiplexer.LastGlobalHeartbeatSecondsAgo + "s ago");
} }
ex = innerException == null var ex = innerException == null
? new RedisConnectionException(failureType, exMessage.ToString()) ? new RedisConnectionException(failureType, exMessage.ToString())
: new RedisConnectionException(failureType, exMessage.ToString(), innerException); : new RedisConnectionException(failureType, exMessage.ToString(), innerException);
...@@ -358,7 +357,6 @@ void add(string lk, string sk, string v) ...@@ -358,7 +357,6 @@ void add(string lk, string sk, string v)
// burn the socket // burn the socket
Shutdown(); Shutdown();
return ex;
} }
public override string ToString() public override string ToString()
...@@ -702,16 +700,18 @@ internal static int WriteRaw(Span<byte> span, long value, bool withLengthPrefix ...@@ -702,16 +700,18 @@ internal static int WriteRaw(Span<byte> span, long value, bool withLengthPrefix
return WriteCrlf(span, offset); return WriteCrlf(span, offset);
} }
internal void WakeWriterAndCheckForThrottle() internal WriteResult WakeWriterAndCheckForThrottle()
{ {
try try
{ {
var flush = _ioPipe.Output.FlushAsync(); var flush = _ioPipe.Output.FlushAsync();
if (!flush.IsCompletedSuccessfully) flush.AsTask().Wait(); if (!flush.IsCompletedSuccessfully) flush.AsTask().Wait();
return WriteResult.Success;
} }
catch (ConnectionResetException ex) catch (ConnectionResetException ex)
{ {
throw RecordConnectionFailed(ConnectionFailureType.SocketClosed, ex); RecordConnectionFailed(ConnectionFailureType.SocketClosed, ex);
return WriteResult.WriteFailure;
} }
} }
......
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