mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-10 17:21:34 +00:00
Deleting AutoScale
table entries on vmss shutdown. (#3455)
* Deleting AutoScale table entries on vmss shutdown. * FIx. * Trying again * Fixing delete. * Updating autoscale to orm * Removing comments.
This commit is contained in:
parent
c4d0cd754b
commit
10bb79a08c
@ -1,5 +1,4 @@
|
||||
using System.Net;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using ApiService.OneFuzzLib.Orm;
|
||||
using Azure;
|
||||
@ -10,9 +9,7 @@ using Microsoft.IdentityModel.Tokens;
|
||||
|
||||
namespace Microsoft.OneFuzz.Service;
|
||||
|
||||
public interface IAutoScaleOperations {
|
||||
|
||||
public Async.Task<ResultVoid<(HttpStatusCode Status, string Reason)>> Insert(AutoScale autoScale);
|
||||
public interface IAutoScaleOperations : IOrm<AutoScale> {
|
||||
|
||||
public Async.Task<AutoScale?> GetSettingsForScaleset(ScalesetId scalesetId);
|
||||
|
||||
|
@ -499,6 +499,13 @@ public class ScalesetOperations : StatefulOrm<Scaleset, ScalesetState, ScalesetO
|
||||
_logTracer.AddHttpStatus(r.ErrorV);
|
||||
_logTracer.LogError("Failed to delete scaleset record {ScalesetId}", scaleset.ScalesetId);
|
||||
}
|
||||
var autoscaleEntry = await _context.AutoScaleOperations.GetSettingsForScaleset(scaleset.ScalesetId);
|
||||
if (autoscaleEntry is null) {
|
||||
_logTracer.LogInformation("Could not find autoscale settings for scaleset {ScalesetId}", scaleset.ScalesetId);
|
||||
} else {
|
||||
_logTracer.LogInformation("Deleting autoscale entry for scaleset {ScalesetId}", scaleset.ScalesetId);
|
||||
_ = await _context.AutoScaleOperations.Delete(autoscaleEntry);
|
||||
}
|
||||
} else {
|
||||
var r = await Update(scaleset);
|
||||
if (!r.IsOk) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user