mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-12 10:08:09 +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:
committed by
GitHub
parent
c4d0cd754b
commit
10bb79a08c
@ -1,5 +1,4 @@
|
|||||||
using System.Net;
|
using System.Text.Json;
|
||||||
using System.Text.Json;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ApiService.OneFuzzLib.Orm;
|
using ApiService.OneFuzzLib.Orm;
|
||||||
using Azure;
|
using Azure;
|
||||||
@ -10,9 +9,7 @@ using Microsoft.IdentityModel.Tokens;
|
|||||||
|
|
||||||
namespace Microsoft.OneFuzz.Service;
|
namespace Microsoft.OneFuzz.Service;
|
||||||
|
|
||||||
public interface IAutoScaleOperations {
|
public interface IAutoScaleOperations : IOrm<AutoScale> {
|
||||||
|
|
||||||
public Async.Task<ResultVoid<(HttpStatusCode Status, string Reason)>> Insert(AutoScale autoScale);
|
|
||||||
|
|
||||||
public Async.Task<AutoScale?> GetSettingsForScaleset(ScalesetId scalesetId);
|
public Async.Task<AutoScale?> GetSettingsForScaleset(ScalesetId scalesetId);
|
||||||
|
|
||||||
|
@ -499,6 +499,13 @@ public class ScalesetOperations : StatefulOrm<Scaleset, ScalesetState, ScalesetO
|
|||||||
_logTracer.AddHttpStatus(r.ErrorV);
|
_logTracer.AddHttpStatus(r.ErrorV);
|
||||||
_logTracer.LogError("Failed to delete scaleset record {ScalesetId}", scaleset.ScalesetId);
|
_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 {
|
} else {
|
||||||
var r = await Update(scaleset);
|
var r = await Update(scaleset);
|
||||||
if (!r.IsOk) {
|
if (!r.IsOk) {
|
||||||
|
Reference in New Issue
Block a user