fix(historian-gateway): dispose alarm-write channel at shutdown + ServerHistorian startup diagnostic
Claude-Session: https://claude.ai/code/session_012SDSQ3AcaXqPcBtDESBRii
This commit is contained in:
+8
-1
@@ -36,7 +36,7 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.Gateway;
|
||||
/// event forever.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public sealed class GatewayAlarmHistorianWriter : IAlarmHistorianWriter
|
||||
public sealed class GatewayAlarmHistorianWriter : IAlarmHistorianWriter, IDisposable
|
||||
{
|
||||
private readonly IHistorianGatewayClient _client;
|
||||
private readonly ILogger<GatewayAlarmHistorianWriter> _logger;
|
||||
@@ -154,4 +154,11 @@ public sealed class GatewayAlarmHistorianWriter : IAlarmHistorianWriter
|
||||
// Unknown/unclassified gRPC code → dead-letter to avoid an infinite drain loop.
|
||||
_ => HistorianWriteOutcome.PermanentFail,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the underlying gateway client and its gRPC channel. The concrete
|
||||
/// <see cref="HistorianGatewayClientAdapter"/> implements <see cref="IDisposable"/>; test doubles
|
||||
/// that only implement <see cref="IAsyncDisposable"/> are safely no-opped by the cast guard.
|
||||
/// </summary>
|
||||
public void Dispose() => (_client as IDisposable)?.Dispose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user