diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2022-01-19 19:52:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-19 19:52:10 +0200 |
commit | c5eb91bad10ea8079c6fa630de54b38762abebaf (patch) | |
tree | da81c515547dfb98a06da9f2be6d289bb5baead5 /health/health.c | |
parent | b003e5fd40c3b42dfacc87db5a7730b76eff0e92 (diff) |
Fix queue removed alerts (#11996)
* delay queueing removed alerts
* parenthesis
* remove debug
Diffstat (limited to 'health/health.c')
-rw-r--r-- | health/health.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/health/health.c b/health/health.c index 7bb05233cd..e94339faec 100644 --- a/health/health.c +++ b/health/health.c @@ -676,6 +676,9 @@ void *health_main(void *ptr) { rrdcalc_labels_unlink(); unsigned int loop = 0; +#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) + unsigned int marked_aclk_reload_loop = 0; +#endif while(!netdata_exit) { loop++; debug(D_HEALTH, "Health monitoring iteration no %u started", loop); @@ -702,6 +705,11 @@ void *health_main(void *ptr) { } } +#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) + if (aclk_alert_reloaded && !marked_aclk_reload_loop) + marked_aclk_reload_loop = loop; +#endif + rrd_rdlock(); RRDHOST *host; @@ -1043,14 +1051,6 @@ void *health_main(void *ptr) { rrdhost_unlock(host); } -#ifdef ENABLE_ACLK -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - if (netdata_cloud_setting && unlikely(aclk_alert_reloaded) && loop > 2) { - sql_queue_removed_alerts_to_aclk(host); - } -#endif -#endif - if (unlikely(netdata_exit)) break; @@ -1075,9 +1075,16 @@ void *health_main(void *ptr) { health_alarm_wait_for_execution(ae); } -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - if (netdata_cloud_setting && unlikely(aclk_alert_reloaded)) - aclk_alert_reloaded = 0; +#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) + if (netdata_cloud_setting && unlikely(aclk_alert_reloaded) && loop > (marked_aclk_reload_loop + 2)) { + rrdhost_foreach_read(host) { + if (unlikely(!host->health_enabled)) + continue; + sql_queue_removed_alerts_to_aclk(host); + } + aclk_alert_reloaded = 0; + marked_aclk_reload_loop = 0; + } #endif rrd_unlock(); |