From d1ee5c77d03620c666e5e91602d905feda2c1c63 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Mon, 9 Dec 2024 20:36:20 +0100 Subject: [PATCH] Persist workflow variables during background execution. (#6195) Added a call to save workflow variables in the BackgroundActivityInvoker to ensure that any changes are persisted during background activity execution. This helps maintain consistency and state integrity across workflow invocations. --- .../Elsa.Workflows.Runtime/Services/BackgroundActivityInvoker.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/Elsa.Workflows.Runtime/Services/BackgroundActivityInvoker.cs b/src/modules/Elsa.Workflows.Runtime/Services/BackgroundActivityInvoker.cs index 6f878b0cf..13eafb8e7 100644 --- a/src/modules/Elsa.Workflows.Runtime/Services/BackgroundActivityInvoker.cs +++ b/src/modules/Elsa.Workflows.Runtime/Services/BackgroundActivityInvoker.cs @@ -41,6 +41,7 @@ public class BackgroundActivityInvoker( activityExecutionContext.SetIsBackgroundExecution(); await activityInvoker.InvokeAsync(activityExecutionContext); await ResumeWorkflowAsync(activityExecutionContext, scheduledBackgroundActivity); + await variablePersistenceManager.SaveVariablesAsync(workflowExecutionContext); } private async Task ResumeWorkflowAsync(ActivityExecutionContext activityExecutionContext, ScheduledBackgroundActivity scheduledBackgroundActivity)