From 502d27de711c6b6886c54bbf4e02ddbcd8f51bd6 Mon Sep 17 00:00:00 2001 From: Gabriele Santomaggio Date: Fri, 25 Oct 2024 12:04:32 +0200 Subject: [PATCH] Rename ClosedReason heartbeats missing string (#395) Signed-off-by: Gabriele Santomaggio --- RabbitMQ.Stream.Client/Connection.cs | 2 +- RabbitMQ.Stream.Client/HeartBeatHandler.cs | 2 +- RabbitMQ.Stream.Client/Reliable/ReliableBase.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/RabbitMQ.Stream.Client/Connection.cs b/RabbitMQ.Stream.Client/Connection.cs index e5c6a68e..a05cd58c 100644 --- a/RabbitMQ.Stream.Client/Connection.cs +++ b/RabbitMQ.Stream.Client/Connection.cs @@ -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"; } diff --git a/RabbitMQ.Stream.Client/HeartBeatHandler.cs b/RabbitMQ.Stream.Client/HeartBeatHandler.cs index 1097c5bd..e3217b6d 100644 --- a/RabbitMQ.Stream.Client/HeartBeatHandler.cs +++ b/RabbitMQ.Stream.Client/HeartBeatHandler.cs @@ -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() diff --git a/RabbitMQ.Stream.Client/Reliable/ReliableBase.cs b/RabbitMQ.Stream.Client/Reliable/ReliableBase.cs index 04110c23..de77230b 100644 --- a/RabbitMQ.Stream.Client/Reliable/ReliableBase.cs +++ b/RabbitMQ.Stream.Client/Reliable/ReliableBase.cs @@ -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) };