From 5fb25170cfb50e3bb2469b7eff2078da9b65c564 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Wed, 17 Sep 2025 15:25:59 +0200 Subject: [PATCH] Handle premature request cancellation during workflow resumption - Use `CancellationToken.None` to avoid canceling workflow execution when clients, like Blazor, terminate requests prematurely. - Add comments for clarification on potential causes. --- .../Endpoints/Bookmarks/Resume/Endpoint.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/Elsa.Workflows.Api/Endpoints/Bookmarks/Resume/Endpoint.cs b/src/modules/Elsa.Workflows.Api/Endpoints/Bookmarks/Resume/Endpoint.cs index 203a88137..1ad568037 100644 --- a/src/modules/Elsa.Workflows.Api/Endpoints/Bookmarks/Resume/Endpoint.cs +++ b/src/modules/Elsa.Workflows.Api/Endpoints/Bookmarks/Resume/Endpoint.cs @@ -38,7 +38,11 @@ internal class Resume(ITokenService tokenService, IWorkflowResumer workflowResum return; } - await ResumeBookmarkedWorkflowAsync(payload, input, asynchronous, cancellationToken); + // Some clients, like Blazor, may prematurely cancel their request upon navigation away from the page. + // In this case, we don't want to cancel the workflow execution. + // We need to better understand the conditions that cause this. + var workflowCancellationToken = CancellationToken.None; + await ResumeBookmarkedWorkflowAsync(payload, input, asynchronous, workflowCancellationToken); if (!HttpContext.Response.HasStarted) await SendOkAsync(cancellationToken);