Skip to content

Commit 0ec7c4a

Browse files
author
Francois ROBION
committed
Compare count of sync commands timeouted with sync timeout
1 parent a9cf378 commit 0ec7c4a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/StackExchange.Redis/PhysicalBridge.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,9 @@ internal void OnHeartbeat(bool ifConnectedOnly)
665665

666666
// This is an "always" check - we always want to evaluate a dead connection from a non-responsive sever regardless of the need to heartbeat above
667667
var totalTimeoutThisHeartbeat = asyncTimeoutThisHeartbeat + syncTimeoutThisHeartbeat;
668-
if ((totalTimeoutThisHeartbeat > 0)
669-
&& tmp.LastReadSecondsAgo * 1_000 > (tmp.BridgeCouldBeNull?.Multiplexer.AsyncTimeoutMilliseconds * 4))
668+
bool deadConnectionOnAsync = asyncTimeoutThisHeartbeat > 0 && tmp.LastReadSecondsAgo * 1_000 > (tmp.BridgeCouldBeNull?.Multiplexer.AsyncTimeoutMilliseconds * 4);
669+
bool deadConnectionOnSync = syncTimeoutThisHeartbeat > 0 && tmp.LastReadSecondsAgo * 1_000 > (tmp.BridgeCouldBeNull?.Multiplexer.TimeoutMilliseconds * 4);
670+
if (deadConnectionOnAsync || deadConnectionOnSync)
670671
{
671672
// If we've received *NOTHING* on the pipe in 4 timeouts worth of time and we're timing out commands, issue a connection failure so that we reconnect
672673
// This is meant to address the scenario we see often in Linux configs where TCP retries will happen for 15 minutes.

0 commit comments

Comments
 (0)