@cryptotaxi247 / netdata-1 / commits / 1fc126012

Delay health until obsoletions check is complete (#13239)

* wait until obsoletions check is complete to run health * run the checks 5 minutes after agent connect time

Emmanuel Vasilakis committed Jun 28, 2022 at 18:36 UTC 1fc126012f7909aeca26a8031d69891c9ee1196f
2 files changed +10 -4
database/rrdhost.c
+5 -4
@@ -1399,10 +1399,11 @@ void rrd_cleanup_obsolete_charts()
1399 rrdhost_unlock(host);
1400 }
1401
1402 - if (host != localhost &&
1403 - host->trigger_chart_obsoletion_check &&
1404 - host->senders_last_chart_command &&
1405 - host->senders_last_chart_command + 120 < now_realtime_sec()) {
1402 + if ( host != localhost &&
1403 + host->trigger_chart_obsoletion_check &&
1404 + ((host->senders_last_chart_command &&
1405 + host->senders_last_chart_command + host->health_delay_up_to < now_realtime_sec())
1406 + || (host->senders_connect_time + 300 < now_realtime_sec())) ) {
1407 rrdhost_rdlock(host);
1408 rrdset_check_obsoletion(host);
1409 rrdhost_unlock(host);
health/health.c
+5
@@ -789,6 +789,11 @@ void *health_main(void *ptr) {
789 host->health_delay_up_to = 0;
790 }
791
792 + // wait until cleanup of obsolete charts on children is complete
793 + if (host != localhost)
794 + if (unlikely(host->trigger_chart_obsoletion_check == 1))
795 + continue;
796 +
797 if(likely(!host->health_log_fp) && (loop == 1 || loop % cleanup_sql_every_loop == 0))
798 sql_health_alarm_log_cleanup(host);
799