ptupitsyn commented on a change in pull request #9817:
URL: https://github.com/apache/ignite/pull/9817#discussion_r808893533



##########
File path: 
modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
##########
@@ -182,6 +203,43 @@ internal sealed class ClientSocket : IDisposable
             TaskRunner.Run(WaitForMessages, TaskCreationOptions.LongRunning);
         }
 
+        /// <summary>
+        /// Gets the heartbeat interval according to server-side and 
client-side configuration.
+        /// </summary>
+        private TimeSpan GetHeartbeatInterval(IgniteClientConfiguration 
clientConfiguration)
+        {
+            var serverIdleTimeoutMs = DoOutInOp(
+                ClientOp.GetIdleTimeout, null, r => r.Reader.ReadLong());
+
+            // ReSharper disable once PossibleLossOfFraction
+            var recommendedHeartbeatInterval = 
TimeSpan.FromMilliseconds(serverIdleTimeoutMs / 3);
+
+            if (recommendedHeartbeatInterval > TimeSpan.Zero)
+            {
+                if (clientConfiguration.HeartbeatInterval < 
recommendedHeartbeatInterval)
+                {
+                    _logger.Info(
+                        $"Server-side IdleTimeout is {serverIdleTimeoutMs}ms, 
" +
+                        $"using configured 
{nameof(IgniteClientConfiguration)}." +
+                        
$"{nameof(IgniteClientConfiguration.HeartbeatInterval)}: " +
+                        clientConfiguration.HeartbeatInterval);
+
+                    return clientConfiguration.HeartbeatInterval;
+                }
+
+                _logger.Info($"Server-side IdleTimeout is 
{serverIdleTimeoutMs}ms, " +
+                             $"using 1/3 of it as heartbeat interval: 
{recommendedHeartbeatInterval}");

Review comment:
       Agree, fixed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to