fix(auditlog): do not log a graceful-stop OperationCanceledException at Error in the telemetry drains (review 2026-10-21 06/COR-2)

This commit is contained in:
Joseph Doherty
2026-10-22 06:18:50 -04:00
parent 15496575bc
commit 268b55e350
2 changed files with 55 additions and 2 deletions
@@ -163,8 +163,8 @@ public class SiteAuditTelemetryActor : ReceiveActor
// Route every async dependency call through the
// per-actor lifecycle token so PostStop cancellation actually
// propagates into the queue read, the gRPC push, and the
// mark-forwarded write. OperationCanceledException is swallowed by
// the catch-all below.
// mark-forwarded write. A shutdown-driven OperationCanceledException is
// swallowed silently by the dedicated catch below.
var ct = _lifecycleCts.Token;
try
{
@@ -204,6 +204,12 @@ public class SiteAuditTelemetryActor : ReceiveActor
.ConfigureAwait(false);
}
}
catch (OperationCanceledException) when (ct.IsCancellationRequested)
{
// Graceful stop: PostStop cancelled the lifecycle token while the drain
// was awaiting the queue / gRPC push. Expected on every orderly shutdown or
// failover — not an error (review 2026-10-21 06/COR-2).
}
catch (Exception ex)
{
// Catch-all so a SQLite hiccup or mapper bug never crashes the
@@ -382,6 +388,10 @@ public class SiteAuditTelemetryActor : ReceiveActor
.ConfigureAwait(false);
}
}
catch (OperationCanceledException) when (ct.IsCancellationRequested)
{
// Graceful stop mid-drain — see OnDrainAsync (review 2026-10-21 06/COR-2).
}
catch (Exception ex)
{
_logger.LogError(ex,