Undo this premature optimization, because it causes finished workflow instances to not find their blueprint in the workflow instances overview list

This commit is contained in:
Sipke Schoorstra 2021-04-28 22:45:00 +02:00
parent 7a70b56ec2
commit de66514f66

View file

@ -41,18 +41,8 @@ namespace Elsa.Services
foreach (var provider in providers)
await foreach (var workflow in provider.GetWorkflowsAsync(cancellationToken).WithCancellation(cancellationToken))
{
// If a workflow is not published, only consider it for processing if it has at least one non-ended workflow instance.
if (!workflow.IsPublished && !await WorkflowHasNonFinishedWorkflowsAsync(workflow, cancellationToken))
continue;
yield return workflow;
}
}
private async Task<bool> WorkflowHasNonFinishedWorkflowsAsync(IWorkflowBlueprint workflowBlueprint, CancellationToken cancellationToken)
{
var count = await _workflowInstanceStore.CountAsync(new NonFinalizedWorkflowSpecification().WithWorkflowDefinition(workflowBlueprint.Id), cancellationToken);
return count > 0;
}
}
}