diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2022-03-14 14:17:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-14 14:17:40 +0200 |
commit | 4f7d29eed5e917624c818413928d05697558f5bb (patch) | |
tree | 7f6382bc2997c2c2224761a2fda9b6584521b36e /database | |
parent | 8640aa223245f845492149ca5706a2a18fb5a1fb (diff) |
Dont check host health enabled if host is null (#12392)
Diffstat (limited to 'database')
-rw-r--r-- | database/sqlite/sqlite_aclk_alert.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/database/sqlite/sqlite_aclk_alert.c b/database/sqlite/sqlite_aclk_alert.c index 4131dae734..3dfe9b356d 100644 --- a/database/sqlite/sqlite_aclk_alert.c +++ b/database/sqlite/sqlite_aclk_alert.c @@ -563,16 +563,18 @@ void aclk_start_alert_streaming(char *node_id, uint64_t batch_id, uint64_t start struct aclk_database_worker_config *wc = NULL; rrd_rdlock(); RRDHOST *host = find_host_by_node_id(node_id); - if (likely(host)) + rrd_unlock(); + if (likely(host)) { wc = (struct aclk_database_worker_config *)host->dbsync_worker ? (struct aclk_database_worker_config *)host->dbsync_worker : (struct aclk_database_worker_config *)find_inactive_wc_by_node_id(node_id); - rrd_unlock(); - if (unlikely(!host->health_enabled)) { - log_access("AC [%s (N/A)]: Ignoring request to stream alert state changes, health is disabled.", node_id); - return; - } + if (unlikely(!host->health_enabled)) { + log_access("AC [%s (N/A)]: Ignoring request to stream alert state changes, health is disabled.", node_id); + return; + } + } else + wc = (struct aclk_database_worker_config *)find_inactive_wc_by_node_id(node_id); if (likely(wc)) { 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); |