< Summary

Information
Class: Elsa.Scheduling.Tasks.ResumeWorkflowTask
Assembly: Elsa.Scheduling
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/Tasks/ResumeWorkflowTask.cs
Line coverage
75%
Covered lines: 15
Uncovered lines: 5
Coverable lines: 20
Total lines: 40
Line coverage: 75%
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%
ExecuteAsync()100%1173.68%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/Tasks/ResumeWorkflowTask.cs

#LineLine coverage
 1using Elsa.Workflows.Runtime;
 2using Elsa.Workflows.Runtime.Exceptions;
 3using Elsa.Workflows.Runtime.Messages;
 4using Microsoft.Extensions.DependencyInjection;
 5using Microsoft.Extensions.Logging;
 6
 7namespace Elsa.Scheduling.Tasks;
 8
 9/// <summary>
 10/// A task that resumes a workflow.
 11/// </summary>
 1812public class ResumeWorkflowTask(ScheduleExistingWorkflowInstanceRequest request) : ITask
 13{
 14    /// <inheritdoc />
 15    public async ValueTask ExecuteAsync(TaskExecutionContext context)
 16    {
 1117        var cancellationToken = context.CancellationToken;
 1118        var workflowRuntime = context.ServiceProvider.GetRequiredService<IWorkflowRuntime>();
 1119        var logger = context.ServiceProvider.GetRequiredService<ILogger<ResumeWorkflowTask>>();
 20
 21        try
 22        {
 1123            var workflowClient = await workflowRuntime.CreateClientAsync(request.WorkflowInstanceId, cancellationToken);
 1124            var runWorkflowInstanceRequest = new RunWorkflowInstanceRequest
 1125            {
 1126                Input = request.Input,
 1127                Properties = request.Properties,
 1128                ActivityHandle = request.ActivityHandle,
 1129                BookmarkId = request.BookmarkId
 1130            };
 1131            await workflowClient.RunInstanceAsync(runWorkflowInstanceRequest, cancellationToken);
 1132        }
 033        catch (WorkflowInstanceNotFoundException ex)
 34        {
 035            logger.LogWarning(
 036                "Scheduled workflow instance {WorkflowInstanceId} no longer exists and was likely deleted. Skipping exec
 037                ex.InstanceId);
 038        }
 1139    }
 40}