Skip to content

Commit

Permalink
[C/C++] Change interval of driver keepalive error reporting.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjpt777 committed Jan 17, 2025
1 parent 95a1df7 commit cc2d0df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
6 changes: 1 addition & 5 deletions aeron-client/src/main/c/aeron_client_conductor.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,8 @@ int aeron_client_conductor_check_liveness(aeron_client_conductor_t *conductor, l
aeron_client_conductor_force_close_resources(conductor);
snprintf(buffer, sizeof(buffer) - 1, "MediaDriver has been shutdown");
conductor->error_handler(conductor->error_handler_clientd, AERON_CLIENT_ERROR_DRIVER_TIMEOUT, buffer);

return -1;
}

if (now_ms > (last_keepalive_ms + (long long)conductor->driver_timeout_ms))
else if (now_ms > (last_keepalive_ms + (long long)conductor->driver_timeout_ms))
{
char buffer[AERON_ERROR_MAX_TOTAL_LENGTH];

Expand All @@ -434,7 +431,6 @@ int aeron_client_conductor_check_liveness(aeron_client_conductor_t *conductor, l
(int64_t)(now_ms - last_keepalive_ms),
(int64_t)conductor->driver_timeout_ms);
conductor->error_handler(conductor->error_handler_clientd, AERON_CLIENT_ERROR_DRIVER_TIMEOUT, buffer);
return -1;
}

if (AERON_NULL_COUNTER_ID == conductor->heartbeat_timestamp.counter_id)
Expand Down
10 changes: 4 additions & 6 deletions aeron-client/src/main/cpp/ClientConductor.h
Original file line number Diff line number Diff line change
Expand Up @@ -450,26 +450,24 @@ class CLIENT_EXPORT ClientConductor

if (nowMs > (m_timeOfLastKeepaliveMs + KEEPALIVE_TIMEOUT_MS))
{
int64_t lastKeepaliveMs = m_driverProxy.timeOfLastDriverKeepalive();
if (nowMs > (lastKeepaliveMs + m_driverTimeoutMs))
int64_t lastDriverKeepaliveMs = m_driverProxy.timeOfLastDriverKeepalive();
if (nowMs > (lastDriverKeepaliveMs + m_driverTimeoutMs))
{
m_driverActive = false;
closeAllResources(nowMs);

if (NULL_VALUE == lastKeepaliveMs)
if (NULL_VALUE == lastDriverKeepaliveMs)
{
DriverTimeoutException exception("MediaDriver has been shutdown", SOURCEINFO);
m_errorHandler(exception);
}
else
{
DriverTimeoutException exception(
"MediaDriver keepalive: age=" + std::to_string(nowMs - lastKeepaliveMs) +
"MediaDriver keepalive: age=" + std::to_string(nowMs - lastDriverKeepaliveMs) +
"ms > timeout=" + std::to_string(m_driverTimeoutMs) + "ms", SOURCEINFO);
m_errorHandler(exception);
}

return 1;
}

if (m_heartbeatTimestamp)
Expand Down

0 comments on commit cc2d0df

Please sign in to comment.