Skip to content

Commit 79f7570

Browse files
authored
Support for HttpContext.RequestAborted cancellation token for Http requests (#9159)
1 parent 805357a commit 79f7570

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

release_notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- Update PowerShell Worker 7.2 to 4.0.2719 [Release Note](https://github.com/Azure/azure-functions-powershell-worker/releases/tag/v4.0.2719)
1111
- Update Node.js Worker Version to [3.6.0](https://github.com/Azure/azure-functions-nodejs-worker/releases/tag/v3.6.0)
1212
- Upgrade PowerShell language worker 7.0 to 4.0.2733 [Release Note](https://github.com/Azure/azure-functions-powershell-worker/releases/tag/v4.0.2733)
13+
- Support for HttpContext.RequestAborted cancellation token for Http requests (#9159)
1314

1415
**Release sprint:** Sprint 140
1516
[ [bugs](https://github.com/Azure/azure-functions-host/issues?q=is%3Aissue+milestone%3A%22Functions+Sprint+140%22+label%3Abug+is%3Aclosed) | [features](https://github.com/Azure/azure-functions-host/issues?q=is%3Aissue+milestone%3A%22Functions+Sprint+140%22+label%3Afeature+is%3Aclosed) ]

src/WebJobs.Script.WebHost/Middleware/FunctionInvocationMiddleware.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ private async Task<IActionResult> GetResultAsync(HttpContext context, IFunctionE
128128
using (logger.BeginScope(scopeState))
129129
{
130130
var applicationLifetime = context.RequestServices.GetService<IApplicationLifetime>();
131-
CancellationToken cancellationToken = applicationLifetime != null ? applicationLifetime.ApplicationStopping : CancellationToken.None;
131+
CancellationToken cancellationToken = context.RequestAborted;
132+
132133
await functionExecution.ExecuteAsync(context.Request, cancellationToken);
133134

134135
if (context.Items.TryGetValue(ScriptConstants.AzureFunctionsDuplicateHttpHeadersKey, out object value))

0 commit comments

Comments
 (0)