Simplify activity context handling in workflows.
Replaced `GetActiveChildren` with a direct `Children` property in `Flowchart.cs` to streamline logic. Removed redundant `GetDescendents`, `GetActiveChildren`, and `GetChildren` methods from `ActivityExecutionContextExtensions.cs`. Also updated GitHub workflows to allow performance-related branches.
This commit is contained in:
parent
a49bf0c05f
commit
d31661926d
1
.github/workflows/packages.yml
vendored
1
.github/workflows/packages.yml
vendored
|
|
@ -5,6 +5,7 @@ on:
|
|||
branches:
|
||||
- 'main'
|
||||
- 'bug/*'
|
||||
- 'perf/*'
|
||||
release:
|
||||
types: [ prereleased, published ]
|
||||
env:
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ public class Flowchart : Container
|
|||
|
||||
if (!hasPendingWork)
|
||||
{
|
||||
var hasFaultedActivities = context.GetActiveChildren().Any(x => x.Status == ActivityStatus.Faulted);
|
||||
var hasFaultedActivities = context.Children.Any(x => x.Status == ActivityStatus.Faulted);
|
||||
|
||||
if (!hasFaultedActivities)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -197,50 +197,6 @@ public static partial class ActivityExecutionContextExtensions
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a flattened list of the current context's descendants.
|
||||
/// </summary>
|
||||
public static IEnumerable<ActivityExecutionContext> GetDescendents(this ActivityExecutionContext context)
|
||||
{
|
||||
var children = context.WorkflowExecutionContext.ActivityExecutionContexts.Where(x => x.ParentActivityExecutionContext == context);
|
||||
|
||||
foreach (var child in children)
|
||||
{
|
||||
yield return child;
|
||||
|
||||
foreach (var descendent in GetDescendents(child))
|
||||
yield return descendent;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a flattened list of the current context's immediate active children.
|
||||
/// </summary>
|
||||
public static IEnumerable<ActivityExecutionContext> GetActiveChildren(this ActivityExecutionContext context) =>
|
||||
context.WorkflowExecutionContext.ActivityExecutionContexts.Where(x => x.ParentActivityExecutionContext == context);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a flattened list of the current context's immediate children.
|
||||
/// </summary>
|
||||
public static IEnumerable<ActivityExecutionContext> GetChildren(this ActivityExecutionContext context) =>
|
||||
context.WorkflowExecutionContext.ActivityExecutionContexts.Where(x => x.ParentActivityExecutionContext == context);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a flattened list of the current context's descendants.
|
||||
/// </summary>
|
||||
public static IEnumerable<ActivityExecutionContext> GetDescendants(this ActivityExecutionContext context)
|
||||
{
|
||||
var children = context.WorkflowExecutionContext.ActivityExecutionContexts.Where(x => x.ParentActivityExecutionContext == context).ToList();
|
||||
|
||||
foreach (var child in children)
|
||||
{
|
||||
yield return child;
|
||||
|
||||
foreach (var descendant in child.GetDescendants())
|
||||
yield return descendant;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send a signal up the current hierarchy of ancestors.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in a new issue