Skip to content

Commit

Permalink
Rename ClosedReason heartbeats missing string (#395)
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriele Santomaggio <[email protected]>
  • Loading branch information
Gsantomaggio authored Oct 25, 2024
1 parent 3ed2978 commit 502d27d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion RabbitMQ.Stream.Client/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal static class ConnectionClosedReason
{
public const string Normal = "TCP connection closed normal";
public const string Unexpected = "TCP connection closed unexpected";
public const string MissingHeartbeat = "TCP connection closed missing heartbeat";
public const string TooManyHeartbeatsMissing = "TCP connection closed by too many heartbeats missing";

}

Expand Down
2 changes: 1 addition & 1 deletion RabbitMQ.Stream.Client/HeartBeatHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private async Task PerformHeartBeatAsync()
// Even it is not a perfect solution, it is a good way to handle the case to avoid to introduce breaking changes
// we need to review all the status and the close reason on the version 2.0
await _close($"Too many heartbeats missed: {_missedHeartbeat}. Client connection will be closed.",
ConnectionClosedReason.MissingHeartbeat).ConfigureAwait(false);
ConnectionClosedReason.TooManyHeartbeatsMissing).ConfigureAwait(false);
}

internal void UpdateHeartBeat()
Expand Down
2 changes: 1 addition & 1 deletion RabbitMQ.Stream.Client/Reliable/ReliableBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected static ChangeStatusReason FromConnectionClosedReasonToStatusReason(str
// Can be removed on the version 2.0 when the ConnectionClosedReason will be an enum as well
return connectionClosedReason switch
{
ConnectionClosedReason.MissingHeartbeat => ChangeStatusReason.DisconnectedByTooManyHeartbeatMissing,
ConnectionClosedReason.TooManyHeartbeatsMissing => ChangeStatusReason.DisconnectedByTooManyHeartbeatMissing,
ConnectionClosedReason.Unexpected => ChangeStatusReason.UnexpectedlyDisconnected,
_ => throw new ArgumentOutOfRangeException(nameof(connectionClosedReason), connectionClosedReason, null)
};
Expand Down

0 comments on commit 502d27d

Please sign in to comment.