fix(adminui): evict unconfigured drivers from status stores; isolate throwing subscribers (R04 L1, L5)
The driver-status and resilience stores had no removal path, so a deleted driver stayed on /hosts as a frozen row until restart. Both stores gain RetainOnly, which /hosts calls after each successful config load (never on a failed one). The stores and InProcessBroadcaster now raise their events one subscriber at a time, so a throwing handler cannot starve later subscribers or escape onto the bridge actor. The alert/script-log bridges publish inside their try, and the resilience bridge catches a store failure instead of restarting. Refs #745 Claude-Session: https://claude.ai/code/session_01Ub9hGmYLQvn9XETzw7CMsT
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Akka.Actor;
|
||||
using Akka.Cluster.Tools.PublishSubscribe;
|
||||
using Akka.Event;
|
||||
using ZB.MOM.WW.OtOpcUa.Commons.Messages.Drivers;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.AdminUI.Hubs;
|
||||
@@ -17,6 +18,7 @@ public sealed class DriverResilienceStatusBridge : ReceiveActor
|
||||
public const string TopicName = DriverResilienceStatusChanged.TopicName;
|
||||
|
||||
private readonly IDriverResilienceStatusStore _store;
|
||||
private readonly ILoggingAdapter _log = Context.GetLogger();
|
||||
|
||||
/// <summary>Creates actor props for a <see cref="DriverResilienceStatusBridge"/>.</summary>
|
||||
/// <param name="store">Resilience status store updated on every forwarded snapshot.</param>
|
||||
@@ -29,7 +31,12 @@ public sealed class DriverResilienceStatusBridge : ReceiveActor
|
||||
public DriverResilienceStatusBridge(IDriverResilienceStatusStore store)
|
||||
{
|
||||
_store = store;
|
||||
Receive<DriverResilienceStatusChanged>(msg => _store.Upsert(msg));
|
||||
Receive<DriverResilienceStatusChanged>(msg =>
|
||||
{
|
||||
// A store failure must not restart the bridge (a restart re-subscribes DPS and drops messages).
|
||||
try { _store.Upsert(msg); }
|
||||
catch (Exception ex) { _log.Warning(ex, "DriverResilienceStatusBridge: upsert failed for {0}", msg.DriverInstanceId); }
|
||||
});
|
||||
Receive<SubscribeAck>(_ => { /* DPS confirmation */ });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user