< Summary

Information
Class: Elsa.Workflows.Runtime.Lifecycle.ElsaShellDrainHandler
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Lifecycle/ElsaShellDrainHandler.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 2
Coverable lines: 2
Total lines: 35
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
DrainAsync(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Lifecycle/ElsaShellDrainHandler.cs

#LineLine coverage
 1using CShells.Lifecycle;
 2using Elsa.Workflows.Runtime.Services;
 3using Microsoft.Extensions.Hosting;
 4using Microsoft.Extensions.Logging;
 5
 6namespace Elsa.Workflows.Runtime.Lifecycle;
 7
 8/// <summary>
 9/// CShells <see cref="IDrainHandler"/> that bridges per-shell drain into the workflow runtime's
 10/// <see cref="IDrainOrchestrator"/>. The shell platform invokes this when a shell enters
 11/// <see cref="ShellLifecycleState.Draining"/> (e.g., on shell reload or host shutdown). The drain handler's
 12/// <see cref="CancellationToken"/> is signalled when the CShells drain deadline elapses, so the orchestrator's
 13/// own deadline-bounded protocol nests cleanly inside the per-shell deadline policy.
 14/// </summary>
 15/// <remarks>
 16/// <para>
 17/// Registered as transient via <c>IShellFeature.ConfigureServices</c>; CShells resolves all
 18/// <see cref="IDrainHandler"/> implementations from the shell's <see cref="IServiceProvider"/> at draining time
 19/// and invokes them in parallel. This gives FR-027 ("a shell moving into its deactivation phase drains that
 20/// shell's runtime, scoped so sibling shells are unaffected") a first-class, per-shell mechanism — replacing
 21/// the earlier R3 design that relied on <c>IHostApplicationLifetime.ApplicationStopping</c>.
 22/// </para>
 23/// <para>
 24/// In CShells-hosted deployments this is the sole drain trigger: host stop reaches the runtime via CShells's
 25/// shell-drain pipeline (<c>CShellsStartupHostedService.StopAsync</c>), not via a host-level
 26/// <see cref="IHostedService"/>. The host-stop <c>DrainOrchestratorHostedService</c> registration only lives on
 27/// the IModule <c>Features/WorkflowRuntimeFeature</c> path, where there is no shell platform.
 28/// </para>
 29/// </remarks>
 030public sealed class ElsaShellDrainHandler(IDrainOrchestrator orchestrator, ILogger<ElsaShellDrainHandler> logger) : IDra
 31{
 32    /// <inheritdoc />
 33    public Task DrainAsync(IDrainExtensionHandle extensionHandle, CancellationToken cancellationToken) =>
 034        DrainTriggerExecutor.RunAsync(orchestrator, DrainTrigger.ShellDeactivation, logger, "Shell drain", cancellationT
 35}