3fb6549209
Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
22 lines
941 B
C#
22 lines
941 B
C#
namespace ZB.MOM.WW.OtOpcUa.Driver.Sql;
|
|
|
|
/// <summary>
|
|
/// Shared helper for work the driver stops waiting on (a timed-out liveness probe or poll group).
|
|
/// </summary>
|
|
internal static class AbandonedTask
|
|
{
|
|
/// <summary>
|
|
/// Observes an abandoned task's eventual fault so it never surfaces as an unobserved task
|
|
/// exception. The task still owns — and disposes — its own connection, and still releases any
|
|
/// concurrency slot when it finally completes; that is what keeps a frozen database from
|
|
/// accumulating connections.
|
|
/// </summary>
|
|
/// <param name="work">The task being abandoned.</param>
|
|
internal static void Detach(Task work)
|
|
=> _ = work.ContinueWith(
|
|
static t => _ = t.Exception,
|
|
CancellationToken.None,
|
|
TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.ExecuteSynchronously,
|
|
TaskScheduler.Default);
|
|
}
|