Send node info update after ACLK connection timeout (#18683)
Send node info update after aclk connection timeout
Stelios Fragkakis committed
Oct 6, 2024 at 10:35 UTC
4d2327582e881d40521b4004512b5469e7a15d62
1 file changed
+7
src/aclk/aclk.c
+7
@@ -285,6 +285,7 @@ static void puback_callback(uint16_t packet_id)
285
286
void aclk_graceful_disconnect(mqtt_wss_client client);
287
288
+bool schedule_node_update = false;
289
/* Keeps connection alive and handles all network communications.
290
* Returns on error or when netdata is shutting down.
291
* @param client instance of mqtt_wss_client
@@ -309,6 +310,7 @@ static int handle_connection(mqtt_wss_client client)
310
break;
311
case ACLK_PING_TIMEOUT:
312
reason = "ping timeout";
313
+ schedule_node_update = true;
314
break;
315
case ACLK_RELOAD_CONF:
316
reason = "reclaim";
@@ -801,6 +803,11 @@ void *aclk_main(void *ptr)
803
if (aclk_attempt_to_connect(mqttwss_client))
804
goto exit_full;
805
806
+ if (schedule_node_update) {
807
+ schedule_node_info_update(localhost);
808
+ schedule_node_update = false;
809
+ }
810
+
811
if (handle_connection(mqttwss_client)) {
812
last_disconnect_time = now_realtime_sec();
813
aclk_set_disconnected();