Skip to content

Commit

Permalink
Fix Join activity not blocking when using WaitAll mode
Browse files Browse the repository at this point in the history
  • Loading branch information
sfmskywalker committed Jul 11, 2021
1 parent e890c68 commit f65cf6b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/Elsa.Core/Activities/ControlFlow/Join/Join.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Elsa.Activities.ControlFlow
Description = "Merge workflow execution back into a single branch.",
Outcomes = new[] { OutcomeNames.Done }
)]
public class Join : Activity, INotificationHandler<ActivityExecuted>
public class Join : Activity, INotificationHandler<WorkflowExecutionPassCompleted>
{
private readonly IMediator _mediator;

Expand Down Expand Up @@ -145,6 +145,11 @@ private async Task RemoveScopeActivitiesAsync(WorkflowExecutionContext workflowE
private void RecordInboundTransitionsAsync(ActivityExecutionContext activityExecutionContext)
{
var activityId = activityExecutionContext.ActivityBlueprint.Id;

// Only record activity execution if the executed activity isn't blocking.
if(activityExecutionContext.WorkflowInstance.BlockingActivities.Any(x => x.ActivityId == activityId))
return;

var workflowExecutionContext = activityExecutionContext.WorkflowExecutionContext;

// Get outbound connections of the executing activity.
Expand Down Expand Up @@ -186,7 +191,7 @@ private string GetTransitionKey(IConnection connection)
return $"@{sourceActivityId}_{sourceOutcomeName}";
}

public Task Handle(ActivityExecuted notification, CancellationToken cancellationToken)
public Task Handle(WorkflowExecutionPassCompleted notification, CancellationToken cancellationToken)
{
RecordInboundTransitionsAsync(notification.ActivityExecutionContext);
return Task.CompletedTask;
Expand Down

0 comments on commit f65cf6b

Please sign in to comment.