diff --git a/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/eps/eps_status_generator.py b/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/eps/eps_status_generator.py index fe041318..e886ac54 100644 --- a/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/eps/eps_status_generator.py +++ b/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/eps/eps_status_generator.py @@ -92,6 +92,9 @@ _HISTORY_MAX = 50 # events persisted per stream _HISTORY_SHOW = 5 # events surfaced to the page per stream _TRACE_MAX = 288 # ring-current samples (24 h at 5 min) _FLAP_COALESCE_S = 60 # re-alarm within this window extends the event +_ALARM_TEXTS_MAX = 100 # distinct alarm texts kept on a single open eps_event; + # only one event is ever open at a time, so this bounds + # total history growth during a long-running flapping alarm _SEVERITY_NAMES = {0: "NO_ALARM", 1: "MINOR", 2: "MAJOR", 3: "INVALID"} @@ -235,7 +238,9 @@ class HistoryTracker: if open_ev is not None: open_ev["count"] = max(open_ev.get("count", 0), count) if text and text not in open_ev.get("texts", []): - open_ev.setdefault("texts", []).append(text) + texts = open_ev.setdefault("texts", []) + texts.append(text) + del texts[:-_ALARM_TEXTS_MAX] return # coalesce a rapid re-alarm with identical text if self.eps_events: