< Summary

Information
Class: Elsa.Workflows.Runtime.HostedServices.DrainOrchestratorHostedService
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/HostedServices/DrainOrchestratorHostedService.cs
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 22
Line coverage: 100%
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%11100%
StartAsync(...)100%11100%
StopAsync(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/HostedServices/DrainOrchestratorHostedService.cs

#LineLine coverage
 1using Elsa.Workflows.Runtime.Services;
 2using Microsoft.Extensions.Hosting;
 3using Microsoft.Extensions.Logging;
 4
 5namespace Elsa.Workflows.Runtime.HostedServices;
 6
 7/// <summary>
 8/// Subscribes to <see cref="IHostApplicationLifetime.ApplicationStopping"/> and runs the drain orchestrator on
 9/// host stop. Registered AFTER <c>InstanceHeartbeatService</c> so that <see cref="IHostedService.StopAsync"/>
 10/// runs in reverse order — drain first, heartbeat last (research R5 / FR-029).
 11/// </summary>
 712public sealed class DrainOrchestratorHostedService(
 713    IDrainOrchestrator orchestrator,
 714    ILogger<DrainOrchestratorHostedService> logger) : IHostedService
 15{
 16    /// <inheritdoc />
 717    public Task StartAsync(CancellationToken cancellationToken) => Task.CompletedTask;
 18
 19    /// <inheritdoc />
 20    public Task StopAsync(CancellationToken cancellationToken) =>
 1021        DrainTriggerExecutor.RunAsync(orchestrator, DrainTrigger.HostStopSignal, logger, "Graceful drain", cancellationT
 22}