662f3f9f5c
v2-ci / build (push) Failing after 32s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (push) Has been skipped
- Topic-name drift fix: DriverHealthChanged.TopicName and DriverControlTopic.Name now live on the message contracts in Commons. AkkaDriverHealthPublisher, DriverStatusSignalRBridge, DriverHostActor, and AdminOperationsActor all delegate to the single constant so a rename can't silently desynchronise publisher and subscriber. - DriverStatusPanel._opResultClearTimer switched from System.Timers.Timer to System.Threading.Timer + awaited DisposeAsync. Prevents an in-flight 8s clear-callback from invoking StateHasChanged on a component whose hub has already been released. - PublishHealthSnapshot deduplicates against the last published (state, lastSuccess, lastError, errorCount) fingerprint. The 30s heartbeat no longer floods the SignalR layer with identical Healthy snapshots — newly-joined clients still warm up via the snapshot store on JoinDriver.
39 lines
1.5 KiB
C#
39 lines
1.5 KiB
C#
using Akka.Actor;
|
|
using Akka.Cluster.Tools.PublishSubscribe;
|
|
using ZB.MOM.WW.OtOpcUa.Commons.Messages.Drivers;
|
|
using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Runtime.Drivers;
|
|
|
|
/// <summary>
|
|
/// Forwards <see cref="DriverHealth"/> transitions to the cluster-wide
|
|
/// <c>driver-health</c> DistributedPubSub topic. Consumed by the AdminUI
|
|
/// <c>DriverStatusSignalRBridge</c>.
|
|
/// </summary>
|
|
public sealed class AkkaDriverHealthPublisher : IDriverHealthPublisher
|
|
{
|
|
/// <summary>The DistributedPubSub topic name for driver-health snapshots — single source
|
|
/// of truth on the message contract itself.</summary>
|
|
public const string TopicName = DriverHealthChanged.TopicName;
|
|
|
|
private readonly ActorSystem _system;
|
|
|
|
/// <summary>Initializes a new instance of <see cref="AkkaDriverHealthPublisher"/>.</summary>
|
|
/// <param name="system">The Akka actor system used to resolve the DPS mediator.</param>
|
|
public AkkaDriverHealthPublisher(ActorSystem system) => _system = system;
|
|
|
|
/// <inheritdoc />
|
|
public void Publish(string clusterId, string driverInstanceId, DriverHealth health, int errorCount5Min)
|
|
{
|
|
var msg = new DriverHealthChanged(
|
|
clusterId,
|
|
driverInstanceId,
|
|
health.State.ToString(),
|
|
health.LastSuccessfulRead,
|
|
health.LastError,
|
|
errorCount5Min,
|
|
DateTime.UtcNow);
|
|
DistributedPubSub.Get(_system).Mediator.Tell(new Publish(TopicName, msg));
|
|
}
|
|
}
|