Skip to content

Commit 6cd3a53

Browse files
committed
Reorder code for improved clarity by relocating the storage of dispatched instances count above dispatch loop.
1 parent 9e284e9 commit 6cd3a53

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/modules/Elsa.Workflows.Runtime/Activities/BulkDispatchWorkflows.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,13 @@ protected override async ValueTask ExecuteAsync(ActivityExecutionContext context
114114
var items = await context.GetItemSource<object>(Items).ToListAsync(context.CancellationToken);
115115
var count = items.Count;
116116

117+
// Store the number of dispatched instances for tracking.
118+
context.SetProperty(DispatchedInstancesCountKey, count);
119+
117120
// Dispatch the child workflows.
118121
foreach (var item in items)
119122
await DispatchChildWorkflowAsync(context, item, waitForCompletion, startNewTrace);
120123

121-
// Store the number of dispatched instances for tracking.
122-
context.SetProperty(DispatchedInstancesCountKey, count);
123124

124125
// If we need to wait for the child workflows to complete (if any), create a bookmark.
125126
if (waitForCompletion && count > 0)

0 commit comments

Comments
 (0)