fix(historian-gateway): dispose recorder value-writer channel + clearer OutboxPath warning
Addresses T18 review: GatewayHistorianValueWriter is a DI singleton holding a gRPC channel — make it IAsyncDisposable so the container closes the channel gracefully at shutdown. Tighten the blank-OutboxPath warning to state startup will fail. Claude-Session: https://claude.ai/code/session_012SDSQ3AcaXqPcBtDESBRii
This commit is contained in:
+7
-1
@@ -25,7 +25,7 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.Gateway.Recorder;
|
||||
/// durably queued must not be re-drained.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public sealed class GatewayHistorianValueWriter : IHistorianValueWriter
|
||||
public sealed class GatewayHistorianValueWriter : IHistorianValueWriter, IAsyncDisposable
|
||||
{
|
||||
private readonly IHistorianGatewayClient _client;
|
||||
private readonly ILogger<GatewayHistorianValueWriter> _logger;
|
||||
@@ -86,4 +86,10 @@ public sealed class GatewayHistorianValueWriter : IHistorianValueWriter
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the underlying gateway client (and its gRPC channel). The DI container owns this
|
||||
/// writer as a singleton, so this fires once at host shutdown — closing the channel gracefully.
|
||||
/// </summary>
|
||||
public ValueTask DisposeAsync() => _client.DisposeAsync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user