Skip to content

Commit

Permalink
Validate heartbeat interval.
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenGroot committed Sep 26, 2023
1 parent 5f7194d commit 9dbe4c6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/TaskServer/TaskServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ private TaskServer(JetConfiguration config, DfsConfiguration dfsConfiguration)

_jobServer = JetClient.CreateJobServerHeartbeatClient(config);
_heartbeatInterval = config.TaskServer.HeartbeatInterval;
if (_heartbeatInterval <= 0)
{
throw new InvalidOperationException("Invalid heartbeat interval");
}

_log.InfoFormat("Heartbeat interval: {0}", _heartbeatInterval);
_immediateCompletedTaskNotification = config.TaskServer.ImmediateCompletedTaskNotification;

_taskRunner = new TaskRunner(this);
Expand Down Expand Up @@ -291,6 +297,7 @@ private void ShutdownInternal()

private void SendHeartbeat()
{
_log.Info("Sending heartbeat");
JetHeartbeatData[] data = null;
lock (_pendingHeartbeatData)
{
Expand All @@ -302,7 +309,6 @@ private void SendHeartbeat()
}

JetHeartbeatResponse[] responses = null;
_log.Info("Sending heartbeat");
RpcHelper.TryRemotingCall(() => responses = _jobServer.Heartbeat(LocalAddress, data), _heartbeatInterval, -1);

if (responses != null)
Expand Down

0 comments on commit 9dbe4c6

Please sign in to comment.