fix(grpc-data): A1 review round 2 N1 + N2 — withdrawals are never dropped; a discarded mark re-arms F5
N1: the deferral keeps every withdrawal (Known: false) regardless of capacity; a known mark beyond capacity is dropped (unknown is safe) and its source remembered. N2: a G3-discarded (or overflowed) deferred mark is reported to its sender as OpcUaPublishActor.ConditionMarksDiscarded (the scripted host is skipped); DriverHostActor puts those conditions back in the F5 window from now, so a driver that does not re-signal gets the diagnostic.
This commit is contained in:
@@ -49,6 +49,7 @@ public sealed partial class DriverHostActor
|
||||
Receive<DriverInstanceActor.AlarmInitialStatePublished>(OnAlarmInitialState);
|
||||
Receive<ConditionSignalTimedOut>(OnConditionSignalTimedOut);
|
||||
Receive<ConditionBackstopElapsed>(OnConditionBackstopElapsed);
|
||||
Receive<PublishActor.ConditionMarksDiscarded>(OnConditionMarksDiscarded);
|
||||
}
|
||||
|
||||
private void ReceiveConditionSignalsWhileStale()
|
||||
@@ -57,6 +58,7 @@ public sealed partial class DriverHostActor
|
||||
_log.Debug("DriverHost {Node}: dropping an initial alarm-state signal from {Id} while Stale", _localNode, m.DriverInstanceId));
|
||||
Receive<ConditionSignalTimedOut>(_ => { });
|
||||
Receive<ConditionBackstopElapsed>(_ => { });
|
||||
Receive<PublishActor.ConditionMarksDiscarded>(_ => { });
|
||||
}
|
||||
|
||||
private ConditionSignalTracker Tracker(string driverInstanceId)
|
||||
@@ -168,6 +170,30 @@ public sealed partial class DriverHostActor
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A1 review round 2 N2: the publish actor discarded a deferred mark of this driver (G3, or the deferral was full),
|
||||
/// so those conditions are still unknown in the node manager. Put them back in the F5 window (from now), so a
|
||||
/// driver that does not re-signal raises the "not signalled" diagnostic for them.
|
||||
/// </summary>
|
||||
private void OnConditionMarksDiscarded(PublishActor.ConditionMarksDiscarded msg)
|
||||
{
|
||||
if (!_conditionSignalTrackers.TryGetValue(msg.Source, out var t) || t.GoodSinceUtc is null) return;
|
||||
if (!_alarmRefsByDriver.TryGetValue(msg.Source, out var refs)) return;
|
||||
var owned = refs.Select(r => r.RawPath).ToHashSet(StringComparer.Ordinal);
|
||||
IEnumerable<string> back = msg.ConditionIds is null
|
||||
? owned
|
||||
: msg.ConditionIds
|
||||
.Where(id => _driverRefByAlarmNodeId.TryGetValue(id, out var target) && target.DriverInstanceId == msg.Source)
|
||||
.Select(id => _driverRefByAlarmNodeId[id].RawPath)
|
||||
.Where(owned.Contains);
|
||||
var before = t.Pending.Count;
|
||||
t.Pending.UnionWith(back);
|
||||
if (t.Pending.Count == before) return;
|
||||
_log.Warning("DriverHost {Node}: {Count} deferred condition-known mark(s) of {Driver} were discarded; back in the F5 window until it signals again",
|
||||
_localNode, t.Pending.Count - before, msg.Source);
|
||||
ArmSignalTimeout(msg.Source, t);
|
||||
}
|
||||
|
||||
private void OnAlarmInitialState(DriverInstanceActor.AlarmInitialStatePublished msg)
|
||||
{
|
||||
if (!IsCurrentChild(msg.DriverInstanceId, Sender))
|
||||
|
||||
Reference in New Issue
Block a user