Skip to content

Commit

Permalink
Respect IncludeDetailInExceptions in MOVED etc scenarios from ResultP…
Browse files Browse the repository at this point in the history
…rocessor (#2267)

ResultProcessor should be more reticent if IncludeDetailInExceptions is disabled
  • Loading branch information
mgravell authored Oct 12, 2022
1 parent f81553b commit bff0811
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
4 changes: 3 additions & 1 deletion docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Release Notes

## Unreleased
- No unreleased changes at this time

- Fix: `MOVED` with `NoRedirect` (and other non-reachable errors) should respect the `IncludeDetailInExceptions` setting


## 2.6.66

Expand Down
20 changes: 17 additions & 3 deletions src/StackExchange.Redis/ResultProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,27 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, in
{
if (isMoved && wasNoRedirect)
{
err = $"Key has MOVED to Endpoint {endpoint} and hashslot {hashSlot} but CommandFlags.NoRedirect was specified - redirect not followed for {message.CommandAndKey}. ";
if (bridge.Multiplexer.IncludeDetailInExceptions)
{
err = $"Key has MOVED to Endpoint {endpoint} and hashslot {hashSlot} but CommandFlags.NoRedirect was specified - redirect not followed for {message.CommandAndKey}. ";
}
else
{
err = "Key has MOVED but CommandFlags.NoRedirect was specified - redirect not followed. ";
}
}
else
{
unableToConnectError = true;
err = $"Endpoint {endpoint} serving hashslot {hashSlot} is not reachable at this point of time. Please check connectTimeout value. If it is low, try increasing it to give the ConnectionMultiplexer a chance to recover from the network disconnect. "
+ PerfCounterHelper.GetThreadPoolAndCPUSummary(bridge.Multiplexer.RawConfig.IncludePerformanceCountersInExceptions);
if (bridge.Multiplexer.IncludeDetailInExceptions)
{
err = $"Endpoint {endpoint} serving hashslot {hashSlot} is not reachable at this point of time. Please check connectTimeout value. If it is low, try increasing it to give the ConnectionMultiplexer a chance to recover from the network disconnect. "
+ PerfCounterHelper.GetThreadPoolAndCPUSummary(bridge.Multiplexer.RawConfig.IncludePerformanceCountersInExceptions);
}
else
{
err = "Endpoint is not reachable at this point of time. Please check connectTimeout value. If it is low, try increasing it to give the ConnectionMultiplexer a chance to recover from the network disconnect. ";
}
}
}
}
Expand Down

0 comments on commit bff0811

Please sign in to comment.