From a49bf0c05fb467de6460c81df70eee49f5ac5eb2 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Mon, 20 Jan 2025 18:07:14 +0100 Subject: [PATCH] Refactor descendant context check in Flowchart activity. Replaced usage of `GetDescendents` with `Children` property for better clarity and efficiency when checking running activity instances. This simplifies the logic and aligns with the existing structure of activity context handling. --- .../Activities/Flowchart/Activities/Flowchart.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/Elsa.Workflows.Core/Activities/Flowchart/Activities/Flowchart.cs b/src/modules/Elsa.Workflows.Core/Activities/Flowchart/Activities/Flowchart.cs index 5824451ac..022ff7a9e 100644 --- a/src/modules/Elsa.Workflows.Core/Activities/Flowchart/Activities/Flowchart.cs +++ b/src/modules/Elsa.Workflows.Core/Activities/Flowchart/Activities/Flowchart.cs @@ -96,8 +96,8 @@ public class Flowchart : Container { var workflowExecutionContext = context.WorkflowExecutionContext; var activityIds = Activities.Select(x => x.Id).ToList(); - var descendantContexts = context.GetDescendents().Where(x => x.ParentActivityExecutionContext == context); - var hasRunningActivityInstances = descendantContexts.Where(x => activityIds.Contains(x.Activity.Id)).Any(x => x.Status == ActivityStatus.Running); + var children = context.Children; + var hasRunningActivityInstances = children.Where(x => activityIds.Contains(x.Activity.Id)).Any(x => x.Status == ActivityStatus.Running); var hasPendingWork = workflowExecutionContext.Scheduler.List().Any(workItem => {