From 4d2327582e881d40521b4004512b5469e7a15d62 Mon Sep 17 00:00:00 2001 From: Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> Date: Sun, 6 Oct 2024 10:35:53 +0300 Subject: [PATCH] Send node info update after ACLK connection timeout (#18683) Send node info update after aclk connection timeout --- src/aclk/aclk.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/aclk/aclk.c b/src/aclk/aclk.c index 2f8e8b703b6a8f..f22185d08f5833 100644 --- a/src/aclk/aclk.c +++ b/src/aclk/aclk.c @@ -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 @@ -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"; @@ -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();