Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pack] Ensuring JobHost restart suppresion aligns with request lifecycle #10638

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
- Introduced proper handling in environments where .NET in-proc is not supported.
- Updated System.Memory.Data reference to 8.0.1
- Address issue with HTTP proxying throwing `ArgumentException` (#10616)
- Updated JobHost restart suppresion in functions APIs to align with request lifecycle (#10638)
21 changes: 9 additions & 12 deletions src/WebJobs.Script.WebHost/Controllers/FunctionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Azure.WebJobs.Script.Description;
using Microsoft.Azure.WebJobs.Script.Management.Models;
using Microsoft.Azure.WebJobs.Script.WebHost.Extensions;
Expand Down Expand Up @@ -80,12 +81,10 @@ public async Task<IActionResult> CreateOrUpdate(string name, [FromBody] Function
return BadRequest($"{name} is not a valid function name");
}

bool success, configChanged;
FunctionMetadataResponse functionMetadataResponse;
using (fileMonitoringService.SuspendRestart(true))
{
(success, configChanged, functionMetadataResponse) = await _functionsManager.CreateOrUpdate(name, functionMetadata, Request);
}
var restartSuspensionScope = fileMonitoringService.SuspendRestart(true);
Response.RegisterForDispose(restartSuspensionScope);
liliankasem marked this conversation as resolved.
Show resolved Hide resolved

(bool success, _, FunctionMetadataResponse functionMetadataResponse) = await _functionsManager.CreateOrUpdate(name, functionMetadata, Request);

if (success)
{
Expand Down Expand Up @@ -200,12 +199,10 @@ public async Task<IActionResult> Delete(string name, [FromServices] IFileMonitor
return NotFound();
}

bool deleted;
string error;
using (fileMonitoringService.SuspendRestart(true))
{
(deleted, error) = await _functionsManager.TryDeleteFunction(function);
}
var restartSuspensionScope = fileMonitoringService.SuspendRestart(true);
Response.RegisterForDispose(restartSuspensionScope);

(bool deleted, string error) = await _functionsManager.TryDeleteFunction(function);

if (deleted)
{
Expand Down