fix(GWC-35): repair re-raised alarm snapshots
This commit is contained in:
@@ -839,15 +839,17 @@ public sealed class GatewayAlarmMonitor : BackgroundService, IGatewayAlarmServic
|
||||
new AlarmFeedMessage { Transition = TransitionFromSnapshot(incoming.Value, AlarmTransitionKind.Raise) },
|
||||
incoming.Key);
|
||||
}
|
||||
else if (existing.CurrentState != incoming.Value.CurrentState
|
||||
&& incoming.Value.CurrentState == AlarmConditionState.ActiveAcked)
|
||||
else if (existing.CurrentState != incoming.Value.CurrentState)
|
||||
{
|
||||
// The alarm was already known but the worker now reports it acknowledged: the
|
||||
// live Acknowledge transition never reached the feed. Without this the acked
|
||||
// state is absorbed silently by the snapshot replace below and subscribers show
|
||||
// the alarm unacked until it clears.
|
||||
// The alarm was already known but the worker now reports a different state. An
|
||||
// ActiveAcked snapshot repairs a missed Acknowledge. Any other incoming active
|
||||
// state repairs a missed Raise for the incoming instance (including an
|
||||
// acknowledged alarm reference that was cleared and re-raised between passes).
|
||||
AlarmTransitionKind kind = incoming.Value.CurrentState == AlarmConditionState.ActiveAcked
|
||||
? AlarmTransitionKind.Acknowledge
|
||||
: AlarmTransitionKind.Raise;
|
||||
Broadcast(
|
||||
new AlarmFeedMessage { Transition = TransitionFromSnapshot(incoming.Value, AlarmTransitionKind.Acknowledge) },
|
||||
new AlarmFeedMessage { Transition = TransitionFromSnapshot(incoming.Value, kind) },
|
||||
incoming.Key);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user