7b0b9c7365
Solution + 23 src projects + 26 test projects renamed; folders, csproj, namespaces, and ScadaLinkDbContext/ScadaBridgeDbContext class updated. ActorSystem "scadalink" → "scadabridge", Akka seed-node URLs migrated. SQL roles/logins, LDAP domains, CLI command name, and CLI config dir (~/.scadalink → ~/.scadabridge) also renamed. Build green; 5 Host.Tests fail awaiting SQL login rename in next commit. Pre-existing StaleTagMonitor timing flakes unchanged. Rename script committed at tools/rename-to-scadabridge.sh.
54 lines
2.0 KiB
C#
54 lines
2.0 KiB
C#
using Microsoft.Extensions.Logging;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.DeploymentManager;
|
|
|
|
/// <summary>
|
|
/// Default <see cref="IDeploymentStatusNotifier"/> implementation. A simple
|
|
/// in-process event broadcaster: registered as a DI singleton so it is shared
|
|
/// between the central-process <see cref="DeploymentService"/> and the Central
|
|
/// UI's Blazor circuits (CentralUI-006).
|
|
///
|
|
/// A throwing subscriber must never break the deployment pipeline, so each
|
|
/// handler is invoked individually and its exceptions are caught and logged.
|
|
/// </summary>
|
|
public sealed class DeploymentStatusNotifier : IDeploymentStatusNotifier
|
|
{
|
|
private readonly ILogger<DeploymentStatusNotifier> _logger;
|
|
|
|
/// <summary>Initializes a new instance of <see cref="DeploymentStatusNotifier"/>.</summary>
|
|
/// <param name="logger">Logger instance used when a subscriber throws.</param>
|
|
public DeploymentStatusNotifier(ILogger<DeploymentStatusNotifier> logger)
|
|
{
|
|
_logger = logger;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public event Action<DeploymentStatusChange>? StatusChanged;
|
|
|
|
/// <inheritdoc />
|
|
public void NotifyStatusChanged(DeploymentStatusChange change)
|
|
{
|
|
var handlers = StatusChanged;
|
|
if (handlers == null)
|
|
return;
|
|
|
|
// Invoke each subscriber in isolation: one faulting handler (e.g. a
|
|
// disposed Blazor circuit) must not stop the others from being notified
|
|
// and must not propagate back into the deployment pipeline.
|
|
foreach (var handler in handlers.GetInvocationList())
|
|
{
|
|
try
|
|
{
|
|
((Action<DeploymentStatusChange>)handler)(change);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_logger.LogWarning(ex,
|
|
"A deployment-status-change subscriber threw for deployment {DeploymentId} " +
|
|
"(status {Status}); continuing with remaining subscribers",
|
|
change.DeploymentId, change.Status);
|
|
}
|
|
}
|
|
}
|
|
}
|