perf(worker): alarm watch-list update diffs the subtag standby instead of rebuilding it (MXA-010, #258)
UpdateAlarmWatchList rebuilt the standby: a second MXAccess registration, an AddItem/Advise for every watched subtag, then an Unregister of the old source — work proportional to the whole list for a one-alarm change (reproduced by the previous commit's test). The subtag standby now takes the list as a diff: added alarms' subtags are advised on the existing source, removed alarms' subtags are unadvised, and unchanged alarms keep their advice and state. The update stays all-or-nothing: the list is validated and the additions advised before the swap, and an advise failure unadvises what it added and keeps the previous list. A changed target starts fresh and is initialised from the last delivered subtag values (acked/priority before active, MXA-007; bad quality still ignored, MXA-005). LmxSubtagAlarmSource tracks an item from AddItem so an Advise failure is retryable and removable.
This commit is contained in:
@@ -459,14 +459,30 @@ its entry.
|
||||
## Live alarm watch-list replacement
|
||||
|
||||
An auto-mode `SubscribeAlarms` with `fallback_enabled = true` always builds a
|
||||
`FailoverAlarmConsumer`, even when initial discovery supplied no targets. The
|
||||
handler retains the subscription expression so `UpdateAlarmWatchList` can build
|
||||
and subscribe a new subtag consumer entirely on the session STA. The failover
|
||||
consumer attaches the replacement's transition callback before swapping the
|
||||
standby reference, then detaches and disposes the old standby. If construction,
|
||||
subscription, or attachment fails, it disposes the replacement and preserves
|
||||
the old standby. The active-provider selector is never reset, so primary mode
|
||||
stays primary and subtag mode immediately delegates to the new standby.
|
||||
`FailoverAlarmConsumer`, even when initial discovery supplied no targets.
|
||||
`UpdateAlarmWatchList` runs entirely on the session STA and applies the new list
|
||||
to the existing `SubtagAlarmConsumer` as a diff (MXA-010): the subtags of added
|
||||
alarms are advised on the standby's existing `LmxSubtagAlarmSource`, the subtags
|
||||
of removed alarms are unadvised (`UnAdvise` + `RemoveItem`), and an alarm whose
|
||||
target is unchanged in every field keeps its advice and its tracked state, so no
|
||||
transition is re-emitted for it. Rebuilding the standby instead cost a second
|
||||
MXAccess registration and an `AddItem`/`Advise` for every watched subtag on each
|
||||
change, however small. An alarm whose target changed is treated as removed and
|
||||
re-added and starts from fresh state; when its subtags are already advised, the
|
||||
consumer initialises it from the last value delivered for each subtag (acked and
|
||||
priority before active, so an already-acknowledged alarm syncs as `ACK_ALM`)
|
||||
rather than re-advising.
|
||||
|
||||
The update is all-or-nothing. The new list is validated and the added subtags
|
||||
are advised before anything is swapped; if advising fails, the subtags the call
|
||||
added are unadvised again, the standby keeps serving the previous list, and the
|
||||
command fails. Unadvising removed subtags happens after the swap and is best
|
||||
effort, because an unbound subtag's callbacks are already ignored. A standby that
|
||||
is not a `SubtagAlarmConsumer` (a test seam) is still rebuilt: the handler
|
||||
retains the subscription expression, builds and subscribes a replacement, and the
|
||||
failover consumer attaches its transition callback before swapping it in and
|
||||
disposing the old one. Either way the active-provider selector is never reset, so
|
||||
primary mode stays primary and subtag mode keeps delegating to the standby.
|
||||
|
||||
## COM Creation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user