Fix save alert config transition on shutdown (#20553)
* Ignore failure to queue message if we are shutting down * Simplify check
Stelios Fragkakis committed
Jun 24, 2025 at 08:00 UTC
c6b7bf499d0c9ada336964acf61a641c9ef9c631
1 file changed
+6
-6
src/health/health_log.c
+6
-6
@@ -40,15 +40,15 @@ void health_alarm_entry_destroy(ALARM_ENTRY *ae) {
40
}
41
42
// ----------------------------------------------------------------------------
43
+extern __thread bool is_health_thread;
44
45
inline void health_alarm_log_save(RRDHOST *host, ALARM_ENTRY *ae, bool async)
46
{
46
- bool saved = false;
47
- if (async)
48
- saved = metadata_queue_ae_save(host, ae);
49
-
50
- // if not async or async failed to queue, do it now
51
- if (false == saved)
47
+ if (async) {
48
+ bool queued = metadata_queue_ae_save(host, ae);
49
+ if (!queued && is_health_thread && service_running(SERVICE_HEALTH))
50
+ sql_health_alarm_log_save(host, ae);
51
+ } else
52
sql_health_alarm_log_save(host, ae);
53
}
54