Skip to content
Tracon

ITraconDrainState

Namespace Tracon · Assembly Tracon.Abstractions.dll

Reports whether the process has begun a graceful shutdown drain.

public interface ITraconDrainState

Backed by TraconDrainService (Tracon.Core), always registered regardless of TraconDrainOptions.Enabled — while disabled, ITraconDrainState.IsDraining simply never becomes true. Consumers that start a run (the HTTP run endpoints, the job worker) check this before accepting new work.

Tenant behavior — TENANT-INDEPENDENT. Draining is a process-wide condition; it has no tenant concept and applies identically regardless of which tenant a new run would belong to.

DI lifetime — singleton. Registered as a singleton with TryAdd; a consumer’s own registration wins.

Guarantee limit: ITraconDrainState.IsDraining does not itself guarantee that no new run starts after it flips. This interface is a READ of the flag only; the register/accept window between a caller checking ITraconDrainState.IsDraining and actually registering a run with IRunCancellationRegistry is not closed by this interface at all. What actually keeps an in-flight run from being cut off mid-shutdown is TWO separate backup mechanism layers this interface does not control: the HTTP host’s own Kestrel request draining (which waits for an in-flight request to finish before the process stops), and the job worker’s own WaitForRunningJobsAsync drain loop. A setup that relies on this flag ALONE, without one of those two layers in its own request path, has no closed guarantee against a run starting in that narrow window (BL-026; see TraconDrainOptions.Enabled too).

Gets whether the process has begun stopping and is waiting for in-flight runs to finish. New runs should not be accepted while this is true.

bool IsDraining { get; }

bool