Skip to content

Commit

Permalink
Ensuring JobHost restart suppresion aligns with request lifecycle (#1…
Browse files Browse the repository at this point in the history
fabiocav authored Nov 18, 2024
1 parent da46c0e commit e332907
Showing 2 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -7,3 +7,4 @@
- Suppress `JwtBearerHandler` logs from customer logs (#10617)
- 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
@@ -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;
@@ -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);

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

if (success)
{
@@ -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)
{

0 comments on commit e332907

Please sign in to comment.