namespace ZB.MOM.WW.OtOpcUa.Driver.Sql;
///
/// Shared helper for work the driver stops waiting on (a timed-out liveness probe or poll group).
///
internal static class AbandonedTask
{
///
/// 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.
///
/// The task being abandoned.
internal static void Detach(Task work)
=> _ = work.ContinueWith(
static t => _ = t.Exception,
CancellationToken.None,
TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.ExecuteSynchronously,
TaskScheduler.Default);
}