Skip to content

Commit

Permalink
Send node info update after ACLK connection timeout (netdata#18683)
Browse files Browse the repository at this point in the history
Send node info update after aclk connection timeout
  • Loading branch information
stelfrag authored Oct 6, 2024
1 parent 902d0b0 commit 4d23275
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/aclk/aclk.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ static void puback_callback(uint16_t packet_id)

void aclk_graceful_disconnect(mqtt_wss_client client);

bool schedule_node_update = false;
/* Keeps connection alive and handles all network communications.
* Returns on error or when netdata is shutting down.
* @param client instance of mqtt_wss_client
Expand All @@ -309,6 +310,7 @@ static int handle_connection(mqtt_wss_client client)
break;
case ACLK_PING_TIMEOUT:
reason = "ping timeout";
schedule_node_update = true;
break;
case ACLK_RELOAD_CONF:
reason = "reclaim";
Expand Down Expand Up @@ -801,6 +803,11 @@ void *aclk_main(void *ptr)
if (aclk_attempt_to_connect(mqttwss_client))
goto exit_full;

if (schedule_node_update) {
schedule_node_info_update(localhost);
schedule_node_update = false;
}

if (handle_connection(mqttwss_client)) {
last_disconnect_time = now_realtime_sec();
aclk_set_disconnected();
Expand Down

0 comments on commit 4d23275

Please sign in to comment.