diff options
Diffstat (limited to 'database/sqlite/sqlite_health.c')
-rw-r--r-- | database/sqlite/sqlite_health.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/database/sqlite/sqlite_health.c b/database/sqlite/sqlite_health.c index 58ee73b543..2ac50867b4 100644 --- a/database/sqlite/sqlite_health.c +++ b/database/sqlite/sqlite_health.c @@ -632,12 +632,15 @@ void sql_health_alarm_log_load(RRDHOST *host) { return; } - netdata_rwlock_rdlock(&host->health_log.alarm_log_rwlock); - - DICTIONARY *all_rrdcalcs = dictionary_create(DICTIONARY_FLAG_NAME_LINK_DONT_CLONE|DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE|DICTIONARY_FLAG_DONT_OVERWRITE_VALUE); + DICTIONARY *all_rrdcalcs = dictionary_create( + DICT_OPTION_NAME_LINK_DONT_CLONE | DICT_OPTION_VALUE_LINK_DONT_CLONE | DICT_OPTION_DONT_OVERWRITE_VALUE); RRDCALC *rc; - foreach_rrdcalc_in_rrdhost(host, rc) + foreach_rrdcalc_in_rrdhost_read(host, rc) { dictionary_set(all_rrdcalcs, rrdcalc_name(rc), rc, sizeof(*rc)); + } + foreach_rrdcalc_in_rrdhost_done(rc); + + netdata_rwlock_rdlock(&host->health_log.alarm_log_rwlock); while (sqlite3_step_monitored(res) == SQLITE_ROW) { ALARM_ENTRY *ae = NULL; @@ -790,11 +793,11 @@ void sql_health_alarm_log_load(RRDHOST *host) { loaded++; } + netdata_rwlock_unlock(&host->health_log.alarm_log_rwlock); + dictionary_destroy(all_rrdcalcs); all_rrdcalcs = NULL; - netdata_rwlock_unlock(&host->health_log.alarm_log_rwlock); - if(!host->health_max_unique_id) host->health_max_unique_id = (uint32_t)now_realtime_sec(); if(!host->health_max_alarm_id) host->health_max_alarm_id = (uint32_t)now_realtime_sec(); |