Skip to content

Commit

Permalink
Merge pull request #6290 from elsa-workflows/feature/blue-delete-fix
Browse files Browse the repository at this point in the history
Added DeleteVariablesAsync method for the workflow context
  • Loading branch information
MariusVuscanNx authored Jan 14, 2025
2 parents 485e6bf + 83b43f8 commit 646fb92
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- 'blueberry'
- 'feature/*'
release:
types: [ prereleased, published ]
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ public interface IVariablePersistenceManager
Task SaveVariablesAsync(WorkflowExecutionContext context);

/// <summary>
/// Deletes the specified variables from the <see cref="WorkflowExecutionContext"/>.
/// Deletes the specified variables from the <see cref="ActivityExecutionContext"/>.
/// </summary>
Task DeleteVariablesAsync(ActivityExecutionContext context);

/// <summary>
/// Deletes the specified variables from the <see cref="WorkflowExecutionContext"/>.
/// </summary>
Task DeleteVariablesAsync(WorkflowExecutionContext context);
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ public async Task DeleteVariablesAsync(ActivityExecutionContext context)
}
}

/// <inheritdoc />
public async Task DeleteVariablesAsync(WorkflowExecutionContext context)
{
var activityContexts = context.ActivityExecutionContexts.ToList();

foreach (var activityContext in activityContexts)
{
await DeleteVariablesAsync(activityContext);
}
}

private IEnumerable<Variable> GetLocalVariables(IExecutionContext context) => context.Variables;

private MemoryBlock EnsureBlock(MemoryRegister register, Variable variable)
Expand Down

0 comments on commit 646fb92

Please sign in to comment.