Fix workflow resumption when activity ids are not explicitly specified
This commit is contained in:
parent
95775643b1
commit
dd823398f5
|
|
@ -32,6 +32,7 @@ namespace Elsa.Services.Models
|
|||
public IServiceProvider ServiceProvider { get; }
|
||||
public bool HasScheduledActivities => scheduledActivities.Any();
|
||||
public bool HasScheduledHaltingActivities => scheduledHaltingActivities.Any();
|
||||
public IEnumerable<IActivity> ScheduledActivities => scheduledActivities;
|
||||
public bool IsFirstPass { get; set; }
|
||||
public LogEntry CurrentLogEntry => Workflow.ExecutionLog.LastOrDefault();
|
||||
public WorkflowExecutionScope CurrentScope => Workflow.Scopes.Peek();
|
||||
|
|
|
|||
|
|
@ -94,8 +94,7 @@ namespace Elsa.Services
|
|||
CancellationToken cancellationToken = default) where T : IWorkflow, new()
|
||||
{
|
||||
var workflow = workflowFactory.CreateWorkflow<T>(input, workflowInstance);
|
||||
var startActivities = workflow.Activities.Find(startActivityIds);
|
||||
return ExecuteAsync(workflow, true, startActivities, cancellationToken);
|
||||
return ResumeAsync(workflow, startActivityIds, cancellationToken);
|
||||
}
|
||||
|
||||
public async Task<WorkflowExecutionContext> ResumeAsync(
|
||||
|
|
@ -108,8 +107,19 @@ namespace Elsa.Services
|
|||
workflowInstance.DefinitionId,
|
||||
VersionOptions.SpecificVersion(workflowInstance.Version),
|
||||
cancellationToken);
|
||||
|
||||
var workflow = workflowFactory.CreateWorkflow(definition, input, workflowInstance);
|
||||
return await ExecuteAsync(workflow, true, startActivityIds, cancellationToken);
|
||||
return await ResumeAsync(workflow, startActivityIds, cancellationToken);
|
||||
}
|
||||
|
||||
public Task<WorkflowExecutionContext> ResumeAsync(
|
||||
Workflow workflow,
|
||||
IEnumerable<string> startActivityIds = default,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
startActivityIds ??= workflow.BlockingActivities.Select(x => x.Id);
|
||||
var startActivities = workflow.Activities.Find(startActivityIds);
|
||||
return ExecuteAsync(workflow, true, startActivities, cancellationToken);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<WorkflowExecutionContext>> TriggerAsync(
|
||||
|
|
@ -419,7 +429,7 @@ namespace Elsa.Services
|
|||
|
||||
if (workflowExecutionContext.HasScheduledActivities)
|
||||
{
|
||||
workflow.BlockingActivities.RemoveWhere(startActivityList.Contains);
|
||||
workflow.BlockingActivities.RemoveWhere(workflowExecutionContext.ScheduledActivities.Contains);
|
||||
|
||||
if (workflowExecutionContext.Workflow.Status == WorkflowStatus.Idle)
|
||||
workflowExecutionContext.Start();
|
||||
|
|
|
|||
Loading…
Reference in a new issue