Merge pull request #6290 from elsa-workflows/feature/blue-delete-fix

Added DeleteVariablesAsync method for the workflow context
This commit is contained in:
MariusVuscanNx 2025-01-14 14:38:29 +02:00 committed by GitHub
commit 646fb92535
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 1 deletions

View file

@ -4,6 +4,7 @@ on:
push:
branches:
- 'blueberry'
- 'feature/*'
release:
types: [ prereleased, published ]
env:

View file

@ -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);
}

View file

@ -110,6 +110,17 @@ public class VariablePersistenceManager : IVariablePersistenceManager
}
}
/// <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)