|
12 | 12 | using Microsoft.AspNetCore.Http.Extensions;
|
13 | 13 | using Microsoft.AspNetCore.Mvc;
|
14 | 14 | using Microsoft.Azure.WebJobs.Extensions.Http;
|
| 15 | +using Microsoft.Azure.WebJobs.Host; |
15 | 16 | using Microsoft.Azure.WebJobs.Script.Description;
|
16 | 17 | using Microsoft.Azure.WebJobs.Script.Management.Models;
|
17 | 18 | using Microsoft.Azure.WebJobs.Script.WebHost.Extensions;
|
@@ -80,12 +81,10 @@ public async Task<IActionResult> CreateOrUpdate(string name, [FromBody] Function
|
80 | 81 | return BadRequest($"{name} is not a valid function name");
|
81 | 82 | }
|
82 | 83 |
|
83 |
| - bool success, configChanged; |
84 |
| - FunctionMetadataResponse functionMetadataResponse; |
85 |
| - using (fileMonitoringService.SuspendRestart(true)) |
86 |
| - { |
87 |
| - (success, configChanged, functionMetadataResponse) = await _functionsManager.CreateOrUpdate(name, functionMetadata, Request); |
88 |
| - } |
| 84 | + var restartSuspensionScope = fileMonitoringService.SuspendRestart(true); |
| 85 | + Response.RegisterForDispose(restartSuspensionScope); |
| 86 | + |
| 87 | + (bool success, _, FunctionMetadataResponse functionMetadataResponse) = await _functionsManager.CreateOrUpdate(name, functionMetadata, Request); |
89 | 88 |
|
90 | 89 | if (success)
|
91 | 90 | {
|
@@ -200,12 +199,10 @@ public async Task<IActionResult> Delete(string name, [FromServices] IFileMonitor
|
200 | 199 | return NotFound();
|
201 | 200 | }
|
202 | 201 |
|
203 |
| - bool deleted; |
204 |
| - string error; |
205 |
| - using (fileMonitoringService.SuspendRestart(true)) |
206 |
| - { |
207 |
| - (deleted, error) = await _functionsManager.TryDeleteFunction(function); |
208 |
| - } |
| 202 | + var restartSuspensionScope = fileMonitoringService.SuspendRestart(true); |
| 203 | + Response.RegisterForDispose(restartSuspensionScope); |
| 204 | + |
| 205 | + (bool deleted, string error) = await _functionsManager.TryDeleteFunction(function); |
209 | 206 |
|
210 | 207 | if (deleted)
|
211 | 208 | {
|
|
0 commit comments