@cryptotaxi247 / netdata-1 / commits / 4f7d29eed

Dont check host health enabled if host is null (#12392)

Emmanuel Vasilakis committed Mar 14, 2022 at 14:17 UTC 4f7d29eed5e917624c818413928d05697558f5bb
1 file changed +8 -6
database/sqlite/sqlite_aclk_alert.c
+8 -6
@@ -563,16 +563,18 @@ void aclk_start_alert_streaming(char *node_id, uint64_t batch_id, uint64_t start
563 struct aclk_database_worker_config *wc = NULL;
564 rrd_rdlock();
565 RRDHOST *host = find_host_by_node_id(node_id);
566 - if (likely(host))
566 + rrd_unlock();
567 + if (likely(host)) {
568 wc = (struct aclk_database_worker_config *)host->dbsync_worker ?
569 (struct aclk_database_worker_config *)host->dbsync_worker :
570 (struct aclk_database_worker_config *)find_inactive_wc_by_node_id(node_id);
570 - rrd_unlock();
571
572 - if (unlikely(!host->health_enabled)) {
573 - log_access("AC [%s (N/A)]: Ignoring request to stream alert state changes, health is disabled.", node_id);
574 - return;
575 - }
572 + if (unlikely(!host->health_enabled)) {
573 + log_access("AC [%s (N/A)]: Ignoring request to stream alert state changes, health is disabled.", node_id);
574 + return;
575 + }
576 + } else
577 + wc = (struct aclk_database_worker_config *)find_inactive_wc_by_node_id(node_id);
578
579 if (likely(wc)) {
580 log_access("AC [%s (%s)]: Start streaming alerts enabled with batch_id %"PRIu64" and start_seq_id %"PRIu64".", node_id, wc->host ? wc->host->hostname : "N/A", batch_id, start_seq_id);