Update WorkflowDefinitionManager to handle dependencies

This update modifies how WorkflowDefinitionManager fetches and handles workflow definitions. It now considers both the latest and published workflow definitions rather than only the published ones. It also removes the dependency id from the list of workflows to consider. A redundant workflow validator from the WorkflowDefinitionPublisher is also removed.
This commit is contained in:
Sipke Schoorstra 2024-02-07 15:51:21 +01:00
parent e64a2eaa17
commit cfac318d7c
2 changed files with 6 additions and 4 deletions

View file

@ -126,12 +126,15 @@ public class WorkflowDefinitionManager : IWorkflowDefinitionManager
{
var updatedWorkflowDefinitions = new List<WorkflowDefinition>();
var publishedWorkflowDefinitions = (await _store.FindManyAsync(new WorkflowDefinitionFilter
var workflowDefinitions = (await _store.FindManyAsync(new WorkflowDefinitionFilter
{
VersionOptions = VersionOptions.Published
VersionOptions = VersionOptions.LatestAndPublished
}, cancellationToken)).ToList();
// Remove the dependency from the list of workflow definitions to consider.
workflowDefinitions = workflowDefinitions.Where(x => x.DefinitionId != dependency.DefinitionId).ToList();
foreach (var definition in publishedWorkflowDefinitions)
foreach (var definition in workflowDefinitions)
{
var root = _activitySerializer.Deserialize(definition.StringData!);
var graph = await _activityVisitor.VisitAsync(root, cancellationToken);

View file

@ -31,7 +31,6 @@ public class WorkflowDefinitionPublisher : IWorkflowDefinitionPublisher
public WorkflowDefinitionPublisher(
IWorkflowDefinitionService workflowDefinitionService,
IWorkflowDefinitionStore workflowDefinitionStore,
IWorkflowValidator workflowValidator,
INotificationSender notificationSender,
IIdentityGenerator identityGenerator,
IActivitySerializer activitySerializer,