Skip to content

Commit bff0811

Browse files
authored
Respect IncludeDetailInExceptions in MOVED etc scenarios from ResultProcessor (#2267)
ResultProcessor should be more reticent if IncludeDetailInExceptions is disabled
1 parent f81553b commit bff0811

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

docs/ReleaseNotes.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Release Notes
22

33
## Unreleased
4-
- No unreleased changes at this time
4+
5+
- Fix: `MOVED` with `NoRedirect` (and other non-reachable errors) should respect the `IncludeDetailInExceptions` setting
6+
57

68
## 2.6.66
79

src/StackExchange.Redis/ResultProcessor.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,27 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, in
267267
{
268268
if (isMoved && wasNoRedirect)
269269
{
270-
err = $"Key has MOVED to Endpoint {endpoint} and hashslot {hashSlot} but CommandFlags.NoRedirect was specified - redirect not followed for {message.CommandAndKey}. ";
270+
if (bridge.Multiplexer.IncludeDetailInExceptions)
271+
{
272+
err = $"Key has MOVED to Endpoint {endpoint} and hashslot {hashSlot} but CommandFlags.NoRedirect was specified - redirect not followed for {message.CommandAndKey}. ";
273+
}
274+
else
275+
{
276+
err = "Key has MOVED but CommandFlags.NoRedirect was specified - redirect not followed. ";
277+
}
271278
}
272279
else
273280
{
274281
unableToConnectError = true;
275-
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. "
276-
+ PerfCounterHelper.GetThreadPoolAndCPUSummary(bridge.Multiplexer.RawConfig.IncludePerformanceCountersInExceptions);
282+
if (bridge.Multiplexer.IncludeDetailInExceptions)
283+
{
284+
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. "
285+
+ PerfCounterHelper.GetThreadPoolAndCPUSummary(bridge.Multiplexer.RawConfig.IncludePerformanceCountersInExceptions);
286+
}
287+
else
288+
{
289+
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. ";
290+
}
277291
}
278292
}
279293
}

0 commit comments

Comments
 (0)