Fixed timeout logic

This commit is contained in:
Kenneth Skovhede
2024-10-01 08:42:34 +02:00
parent 1b9363e23a
commit 6ecbaa6da1
@@ -46,6 +46,11 @@ public class KeepRemoteConnection : IDisposable
/// </summary>
private static readonly TimeSpan ReconnectInterval = TimeSpan.FromSeconds(30);
/// <summary>
/// The interval between reconnect attempts
/// </summary>
private static readonly TimeSpan NoResponseTimeout = TimeSpan.FromSeconds(30);
/// <summary>
/// The interval between heartbeats
/// </summary>
@@ -179,9 +184,8 @@ public class KeepRemoteConnection : IDisposable
/// </summary>
private Task RunMainLoop()
{
//TODO: If we close the socket, it reconnects immediately
// casuing excessive usage
_client.ReconnectTimeout = ReconnectInterval;
_client.ReconnectTimeout = NoResponseTimeout;
_client.LostReconnectTimeout = ReconnectInterval;
_client.IsReconnectionEnabled = true;
_client.DisconnectionHappened.Subscribe(info =>