diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2023-03-23 10:23:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-23 10:23:19 +0200 |
commit | c46b8e9fcc614ce08415b00ad4ba617e40b1443e (patch) | |
tree | 872523bdac6daefd5f5082c4a160e577d762a921 /database/sqlite/sqlite_aclk_node.c | |
parent | 62d63229b55f71c4db0eaae73819c203c490c061 (diff) |
Schedule node info to the cloud after child connection (#14790)
* Schedule node info to the cloud after child connection
* Remove debug code
* Schedule localhost node info within 5 seconds of startup. If no children are detected Or a child connects (switch to immediate localhost node info update)
Diffstat (limited to 'database/sqlite/sqlite_aclk_node.c')
-rw-r--r-- | database/sqlite/sqlite_aclk_node.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/database/sqlite/sqlite_aclk_node.c b/database/sqlite/sqlite_aclk_node.c index bc7eadf99f..0f636b063a 100644 --- a/database/sqlite/sqlite_aclk_node.c +++ b/database/sqlite/sqlite_aclk_node.c @@ -73,8 +73,6 @@ static void build_node_info(char *node_id __maybe_unused) return; } - wc->node_info_send = 1; - rrd_rdlock(); node_info.node_id = wc->node_id; node_info.claim_id = get_agent_claimid(); @@ -148,20 +146,19 @@ void aclk_check_node_info_and_collectors(void) dfe_start_reentrant(rrdhost_root_index, host) { + struct aclk_sync_host_config *wc = host->aclk_sync_host_config; + if (unlikely(!wc)) + continue; + if (unlikely(rrdhost_flag_check(host, RRDHOST_FLAG_PENDING_CONTEXT_LOAD))) { info("ACLK: 'host:%s' not sending node info, context load is pending", rrdhost_hostname(host)); continue; } - struct aclk_sync_host_config *wc = host->aclk_sync_host_config; - - if (unlikely(!wc)) - continue; - - if (wc->node_info_send) { + if (wc->node_info_send_time && wc->node_info_send_time + 30 < now_realtime_sec()) { + wc->node_info_send_time = 0; build_node_info(strdupz(wc->node_id)); internal_error(true, "ACLK SYNC: Sending node info for %s", rrdhost_hostname(host)); - wc->node_info_send = 0; } if (wc->node_collectors_send && wc->node_collectors_send + 30 < now_realtime_sec()) { |