Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2778: Run CheckInfoReplication even with HeartbeatConsistencyChecks #2784

Merged
merged 2 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Current package versions:
- Add support for hash field expiration (see [#2715](https://github.com/StackExchange/StackExchange.Redis/issues/2715)) ([#2716 by atakavci](https://github.com/StackExchange/StackExchange.Redis/pull/2716]))
- Add support for `HSCAN NOVALUES` (see [#2721](https://github.com/StackExchange/StackExchange.Redis/issues/2721)) ([#2722 by atakavci](https://github.com/StackExchange/StackExchange.Redis/pull/2722))
- Fix [#2763](https://github.com/StackExchange/StackExchange.Redis/issues/2763): Make ConnectionMultiplexer.Subscription thread-safe ([#2769 by Chuck-EP](https://github.com/StackExchange/StackExchange.Redis/pull/2769))
- Fix [#2778](https://github.com/StackExchange/StackExchange.Redis/issues/2778): Run `CheckInfoReplication` even with `HeartbeatConsistencyChecks` ([#2784 by NickCraver and leachdaniel-clark](https://github.com/StackExchange/StackExchange.Redis/pull/2784))

## 2.8.0

Expand Down
12 changes: 9 additions & 3 deletions src/StackExchange.Redis/PhysicalBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,8 @@ internal void OnHeartbeat(bool ifConnectedOnly)
tmp.BridgeCouldBeNull?.ServerEndPoint?.ClearUnselectable(UnselectableFlags.DidNotRespond);
}
int timedOutThisHeartbeat = tmp.OnBridgeHeartbeat();
int writeEverySeconds = ServerEndPoint.WriteEverySeconds,
checkConfigSeconds = ServerEndPoint.ConfigCheckSeconds;
int writeEverySeconds = ServerEndPoint.WriteEverySeconds;
bool configCheckDue = ServerEndPoint.ConfigCheckSeconds > 0 && ServerEndPoint.LastInfoReplicationCheckSecondsAgo >= ServerEndPoint.ConfigCheckSeconds;

if (state == (int)State.ConnectedEstablished && ConnectionType == ConnectionType.Interactive
&& tmp.BridgeCouldBeNull?.Multiplexer.RawConfig.HeartbeatConsistencyChecks == true)
Expand All @@ -617,9 +617,15 @@ internal void OnHeartbeat(bool ifConnectedOnly)
// If we don't get the expected response to that command, then the connection is terminated.
// This is to prevent the case of things like 100% string command usage where a protocol error isn't otherwise encountered.
KeepAlive(forceRun: true);

// If we're configured to check info replication, perform that too
if (configCheckDue)
{
ServerEndPoint.CheckInfoReplication();
}
}
else if (state == (int)State.ConnectedEstablished && ConnectionType == ConnectionType.Interactive
&& checkConfigSeconds > 0 && ServerEndPoint.LastInfoReplicationCheckSecondsAgo >= checkConfigSeconds
&& configCheckDue
&& ServerEndPoint.CheckInfoReplication())
{
// that serves as a keep-alive, if it is accepted
Expand Down
Loading